I am working on a fps, and i can get it to shoot, and to fallow the mouse side to side, but it will only shoot at a fixed height. i want it to shoot on the Y axis too.
please help!
(this is the script I’m using to shoot)
var projectile : Rigidbody;
var speed = 20;
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 );
}
}