Rotation around an object

Hello,

I'm an absolute newbie in 3D and jME…

My simple problem is: I want to rotate (with keys) the box in the example "HelloMosuePick" around one axis, so that I can pick each side of the box by turning it.







Thanks for your help

19  readers and no answer?  :?

my problem in other words: I want to rotate an object with keys so that I can look around the object and pick different parts of the object…



In hope of help!

there are many ways.

one is:

  1. define a new Key to do something: in simpleInitGame()


KeyBindingManager.getKeyBindingManager().set( "rotate", KeyInput.KEY_G );



2. in the update() method check if the key is pressed and rotate the object around the Y Axis:



if (KeyBindingManager.getKeyBindingManager().isValidCommand("rotate", true) ) {
    // this roates the quad 0.1f degree around the Y axis, everytime the update method gets called
    b.getLocalRotation().multLocal(new Quaternion().fromAngleAxis(FastMath.DEG_TO_RAD*0.1f, Vector3f.UNIT_Y));
}

Hi Core-Dump,



thanks - works fine!

The fog over jME is lifting slowly.