When I try to position an enemy a certain distance behind the player. They both have their centers facing the same way. If I add distance +, it will show behind the player as it should, then if the player turns 180, it shows up in front.
I’m not sure, but localPosition is the position of an object local to its parent (i.e. you can position a hat on a character to be +1 on the Z axis, and it’ll stay there).
If you want to place an object behind another, you should probably use the object’s worldOrientation, like:
This isn’t the entire code, but it sets the world position of “other” to be the object’s world position plus the direction it’s heading on the Y axis. You can multiply the vector by how many Blender Units you want to place the other object away.
I’m not sure myself - I think matrices might have been column aligned by default back then. You might want to check the 2.49 API to see if such an attribute exists.
Thanks, both of you.
I was using obj.worldOrientation[1], then I tried with localOrientation[1] and both were a total mess. Kept aligning it along the world’s + or - Y axes whether I added or substracted distance. I am going to use something else.