Shooting in the LookAt direction

HI!

So at the moment i have a simple script which determines the direction of a bullet using AddForce:

var bulletSpeed : float = 200.0;

function Update () {

	rigidbody.AddForce(Vector3(bulletSpeed, 0, 0));
	
}

I also use a simple LookAt script for my ‘gun’ to look at an object variable:

var myTarget : Transform;

function Update () {

transform.LookAt(myTarget);

}

All i want is for my bullet to travel in the same direction as the LookAt…is this possible?

Thanks, Tom :slight_smile:

rigidbody.AddForce**(Vector3.forward** * bulletSpeed);

You have to put a reference about player’s orientation.