私は Unity3D の初心者です。ゲーム中に球体などのオブジェクトを作成するにはどうすればよいですか? 次の JavaScript コードが見つかりました。
var projectile : Rigidbody;
var speed = 20;
function Update()
{
if( Input.GetKeyDown( KeyCode.Mouse0 ) )
{
var instantiatedProjectile : Rigidbody = Instantiate( projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider, transform.root.collider );
}
}
このスクリプトは、移動するオブジェクトを作成しますか? このスクリプトが必要で、後で処理する必要があるとしますか? 球体の動きをプログラミングしていたとき、球体にスクリプトを添付しました。