Hi, sorry guys I know this kind of stuff is plastered everywhere, but because of that there is to much info and most of it not relevant making it hard to find out what I want to know…
If I have two 3d points, say… myPos and targetPos and I subtract myPos from targetPos I get a direction vector between the two, ok cool… the magnitude is the length or distance between the two but that’s irrelevant so lets turn it into a unit vector by normalizing it…
I know I can swap a direction vector back and forth between local and world coords using transform.TransformDirection and transform.InverseTransformDirection
But how do I get pitch and yaw scalar’s from this direction vector so I can do things like report to the player with some glee, something like… Target 20 degrees up or 45 degrees right (from the players orientation of course)
I know I can use Vector3.Angle to get a single angle in degrees but I really need it broken down into pitch and yaw components.
And then following on from that… If all I knew was the position of something (local or world) and some pitch and yaw scalars how do I get back to a unit vector direction?
I have been playing around with this for ages now and just spent all evening searching the web… and all I am doing is getting myself move confused and It seems what I am trying to do is simple enough.