This has been puzzling me for months, I use transform.forward and the bullet goes backwards, it’s a side-scroller, I tried switching the values to negative but it changes nothing, only solution I see right now is to flip the world completely but then my avatar wouldn’t move from left to right anymore!! Please take a look at my code:
Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 90);
//Retrieve the Rigidbody component from the instantiated Bullet and control it.
Rigidbody Temporary_RigidBody;
Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent<Rigidbody>();
//Tell the bullet to be "pushed" forward by an amount set by Bullet_Forward_Force.
Temporary_RigidBody.AddForce(transform.forward * Bullet_Forward_Force);
Just to cover the basics; is it possible your bullet model is reversed? Make sure the front of it is aligned to +Z, or perhaps it’s being instantiated backwards for some reason. Transform.forward applies to the local +Z vector of the bullet.
Let me ask you this, is this bullet game object animated? If so I think the animation will play the object in the direction it was animated in, I think regardless of what you do to the game object in the script.
To help narrow down the problem create a brand new game object and use your script on it and see if it will move in the direction you are expecting. If none of this works let us know.
Make the bullet a child of an empty object. Move the empty object and orient the bullet child whichever way you wish, within.
Sometimes these tasks become easier if you use AddRelativeForce and add the force on the Z axis.
The problem was that the Bullet Prefab’s RigidBody was set to isKinematic and I wasn’t adding enough Force to move it, so it wasn’t moving backwards, the vehicle was moving forward and the bullets I was shooting were staying at the same spot. It gave the illusion they were traveling backwards.
Thanks for your help and sorry for the delay in answering.