How to roll a cube along the game world?

Hi all

I am trying jMonkeyEngine out and is trying to learn how to make some small games with it. I am having a problem. I have a simple rectangular cube which is my intention that the player should be able to rol around the gameworld.

When he presses the arrow keys the cube should make a roll towards the way the user pressed the array key, so if he presses the right arrow key, the cube rolls 1 WU to the right.

The problem is not to move the cube, which I can du with the move() method, but my problem is how I make this rotation effect so it doesn’t look like the cube is moving to the destination, but is actually rolling.

The rolling effect should be like the cube in this game (See youtube video below)


I would probably do it with a motionpath. You will know the time it takes for the path to run its course, which should make your life easy when calculating the rotation from 0 to 90 degrees in the process.

1 Like

Hi I can’t find a proper way of getting the rotation animation done with motion path. I have got an answer on another forum, where they suggest me to use a pivot node, and rotate the cube around that… Is this a better solution, and how can I implement that?

I got another solution. By using a Pivot node.

See this post for more information.