I’m attempting to instantiate a bullet prefab and apply a force to it based on the guns rotation. Right now the bullet simply drops. This is for enemies and I want to have a grenade type effect. I instantiate the bullet like so in the gun script:
Instantiate(bullet, bulletSpawn.transform.position, transform.rotation);
the bullet should be set to the gun’s rotation, is this correct?
In the bullet movement script I thought I would be able to simply use transform.forward because the bullet rotation would be the same as the guns rotation when the bullet was instantiated.
void FixedUpdate () {
Vector3 rot = transform.forard;
rigidbody2D.AddForce(rot * speed);
}//late update
Any help would be greatly appreciated. Thanks.