I’ve been through all the questions on changing velocity relative to rotation and am still stuck. Hopefully this is just some noob thing I’m missing.
This is what’s going on: If I face down the Z axis, everything works fine, but if I face down the X axis, all movement is inverted.
Here is my code:
float yRot = mouseLook.curYRotation;
_transform.rotation = Quaternion.Euler (0f,yRot,0f);
_rigidbody.velocity = new Vector3 (Input.GetAxis ("Horizontal") * speed, _rigidbody.velocity.y, Input.GetAxis ("Vertical") * speed);
_rigidbody.velocity = transform.InverseTransformDirection (_rigidbody.velocity);
help much appreciated
edit: ok, I figured it out just had to use TransformDirection instead of InverseTransformDirection