Getting Direction

What would be the best way to get the current Direction of an object?

I’m going to bed now, but I’ll be tackling this issue when I’m back on the job; but it would help a lot if someone could show me the most simple way, since I’m still a Noob.

It would save me time.

:smiley:

yourNode.getHpr()

It was the H component of HPR, so the call was:

instance.getH();

I just basically want to know which way the instance was facing base on the “up right” position.

Didn’t sleep that well… :cry:

:smiley:

That just goes to show you how different programs are. In the past I would use objX-valcos(dirpi/10); objY+valsin(dirpi/180) and have no issues getting the Cam to stay behind an object.

For Panda, I had to reverse the cos and sin in order to get it to work, and I just finished a Commercial Casual Game this year where it was the other way around.

That’s why I don’t like learning new Engine APIs. lol :wink:

if all you want to do is to have you camera follow your node, just reparent the camera to that node.
if you start using sin/cos and stuff in panda , chances are you’r not using panda the way it’s intended.