How do i turn player's rotation into his direction.

ok this is probably my biggest challenge. I need to take the player’s rotational values and turn it into his direction and then move him. The player is a spaceship so it will be moving in all 3 dimensions so im kinda stuck on how i would go about doing this. I couldnt find anything in the manual that covers this does anyone know of something that could help me?

Not sure what you mean. But if you want to use an object forward in it’s own direction, use this:

player.setY(player, 1000.0 * globalClock.getDt())

Replace 1000.0 with the speed.

I think I understand what you want. By “rotational values” you’re talking about HPR right? Pro-rsoft’s code will work great.

Modifying the node’s hpr will change the direction it faces. To move forward in the direction it is facing, we want it to move forward in the Y-direction with respect to the model.

In my game, I do this by:


Here “dt” is defined in the task loop as the time between frames which is multipled by a speed value “self.speed” which will result in constant velocity in the model’s forward direction.