A Simple Projectile Problem :S

See my problem? XD no matter the characters rotation the rockets continue to fire that same direction, I know this is a silly little problem but its really been bugging me and knowing a fix would help make my day :slight_smile:

I would just like to have the rockets fire forward. I have been taking from the TornadoTwins tutorials for the worm game to try to get this to work, but as they use a spherical fire ball projectile it wasn’t mentioned how to make it point in the same direction as the player faces.

The code I have for the Rocket Fire;

var rocketPrefab:Transform;

function Update () 
{
	if(Input.GetButtonDown("Fire1"))
	{
		var rocket = Instantiate(rocketPrefab, 
										GameObject.Find("spawnPoint").transform.position, 
										Quaternion.identity);
		rocket.rigidbody.AddForce(transform.forward *2000);
		
	}
}

This spawns the rocket from an invisible spawn point object placed in front of the characters right hand.

Any help will be much appreciated and help me move onto my next steps of letting the character fire at different angles as the rotation of the movement is controlled by mouse orbit. Also these are just placeholder graphics while I get my engine working before I spruce them up :wink:

:slight_smile: Sir MaXx

var rocket = Instantiate(rocketPrefab, 
										GameObject.Find("spawnPoint").transform.position, 
										transfrom.rotation);

Thats perfect MitchStan thank you very much for your help :slight_smile: I know it was a very noobish question xD