Hi there,
I am trying to create a boss fight for a game, and the basic operation I need is for the boss to move slowly until he looks at the player.
so my idea was to create a node attached to the boss (sentry).
self.innerCompass = self.sentryNode.attachNewNode(“InnerCompass”)
and then when the player come close enough to the boss, this node would look at the player
self.innerCompass.lookAt(self.player.playerNode.getPos(render))
And then tell me the angle in the plane XY where the player is
print “Angle of compass”, self.sentry.innerCompass.getH()
or
print “Angle of compass”, self.sentry.innerCompass.getH(render)
and then use that difference to make the boss move slowly to face the player,
if(math.fabs(self.sentry.getH() - self.sentry.innerCompass.getH()>=0)):
self.sentry.setH(self.sentry.getH()-AMOUNT_OF_CHANGE)
elif(math.fabs(self.sentry.getH() - self.sentry.getCompassH()<0)):
self.sentry.setH(self.sentry.getH()+AMOUNT_OF_CHANGE)
But the problem is that, when I ask for the value of the H angle of the node that follows the player
self.sentry.innerCompass.getH(render)
Instead of giving me a value of 0 to 360, it gives me a weird value between 15 to 27 that does not make any sense at least to me, and I can not compare it with the H of the main node of the Boss.
Maybe there is something I do not understand about how lookAt works,
Thanks in advance for your help,