- Home /
Question by
calyston000 · Nov 24, 2011 at 09:31 PM ·
instantiatetransformtranslate
Bullet Translation question
Hi all. Here my problem. I'm shooting a bullet from a gun muzzle, the bullet is not a rigidbody.
The problem is that the bullet (clone of) instatiate really well. But the bullet wont translate.
Here is my code :
//Bullet variables
public var bulletModel:Transform;
public var bulletSpawn:Transform;
public var bulletSpeed:float = 25;
function Update ()
{
Shoot();
}
public function Shoot():void
{
if(Input.GetMouseButtonDown(0))
{
var cloneBullet:Transform;
Instantiate(bulletModel, bulletSpawn.transform.position, bulletSpawn.transform.rotation);
cloneBullet.transform.Translate(Vector3.forward * Time.deltaTime);
}
}
Problem's is it won't translate at all and also i would like use (bulletSpawn.Vector3.forward * Time.deltaTime) to get the angle of the bulletSpawn.
Thank you all!
Comment