Hi,
I am trying to make a car shooter, where you shoot enemy cars. I have this script for a bullet:
//Attach to empty object, in front of barrel
var projectile : Rigidbody;
var speed = 20;
var RotateX = 0;
var RotateY = 0;
var RotateZ = 0;
function Update()
{
if( Input.GetButton( "Fire1" ) ) {
var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position, transform.rotation);
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
// Physics.IgnoreCollision( instantiatedProjectile. collider,transform.root.collider );
}
}
It works fine when I am moving forward, but when I move left to right, the bullets go all over the place. How can I get them to always move in a straight line?