I want to move an object in the direction the player faces. But for some reason it just shoots straight up the y axis. Thanks for any help.
SomeObject.rigidbody.AddForce(new Vector3(transform.localRotation.x,transform.localRotation.y,transform.localRotation.z));
Try this:
float force_strength = 5;
SomeObject.rigidbody.AddForce( transform.forward * force_strength);
transform.forward gives you the normalised forward facing vector of that object. Hence the need to multiple it by a force_strength as the force will be very weak otherwise!
Thanks! It works perfectly! But I noticed there isn’t a transform.back. How am I supposed to do that?