hi I need an objects global heading not it's local heading or transform.forward. Imagine an aircraft having to yaw into wind as it flies forward. It's the same kind of heading a GPS gives as it looks at the angle from to consecutive points. In a boat it's known as COG ( course over ground ) and is not the direction the boat is necessarily facing. Anyway, if I've made any sense, I'd appreciate some help, thanks.
LeftyRighty, yes I am, that's how I manage this movement, so an add force from the side. And BoredMormon, I'll draw a picture asap. Thanks
If you are using a rigidbody do you simply want to read rigidbody.velocity? You can normalize it if you need a unit vector.
looks good, thanks BoredMormon, so I'm trying: Code (CSharp): float angle = (Mathf.Atan2(transform.rigidbody.velocity.x,transform.rigidbody.velocity.z) * Mathf.Rad2Deg); angle = (angle + 360f) % 360f; looks good so far.
Just to add if anyone needs this kind of thing, the SOG ( speed over ground ) is 'transform.rigidbody.velocity.magnitude' but my forward (local) speed ( which is the same as SOG if there are no side forces) is: Code (CSharp): SPD = transform.rigidbody.velocity - sideForceVector; SPD.magnitude; //test Debug.DrawRay (transform.position, SPD, Color.red);