I need to determine the direction one of the faces of my cubes is pointing relative to its parent node. I need to just determine is it facing: left, right, up, down, back or forward.
vecY returns numbers in the range of -.5 to .5, but I’m not fully understanding how to use this vector to determine my general direction like left, right, up, etc.
hpr (heading, pitch, roll) are the rotations of the object (in degrees from what I’ve seen)
Look here for an explanation of each rotation: http://en.wikipedia.org/wiki/Flight_dynamics
Perhaps I’ve misunderstood your question entirely however… the example I gave gives the rotation of the object, do you want it relative to the parent or something? If so, getHpr() takes in a nodepath to be ‘relative to’ if you like. For instance:
My guess is that you will find one axis in the vector you get back will be positive or negative depending if the positive Y face on the cube is pointing towards or away from the parent. If you normalize it then 0 should mean it is sideways, 1 should mean it is facing towards, and -1 should mean it is facing away.
Thanks, that’s definitely leading me in the right direction.
I’m also looking at what the other axis are doing and it is hard to tell which one to use. I keep thinking I’m seeing the pattern and then I twist my model in one way and I get nothing from one of the relative vectors axis. I guess that makes sense though that one should stay relatively static, but it is making it harder to come up with the pattern.