Hi,
Im trying to do simple rotation of a box
Quaternion quat = new Quaternion(30, 30, 30, 30);
box.setLocalRotation(quat);
box.updateModelBound();
box.updateGeometry();
and its not rotating at all, what am i missing?
Umm, you are just setting the rotation…
not rotating the box.
Check out the TestBoxColor test.
Also, this doesn't look to be a valid rotation.
Quaternion quat = new Quaternion(30, 30, 30, 30);
Try a method like fromAngleNormalAxis()...
Quaternion quat = new Quaternion();
quat.fromAngleNormalAxis(35 * FastMath.DEG_TO_RAD, Vector3f.UNIT_Y);
box.setLocalRotation(quat);
box.updateModelBound();
box.updateGeometry();
Also, HelloAnimation.java uses this technique along with a controller to spin a cube, might be worth a look.
thanks alot, nows its clear to me
one more thing… is there any piece of code that shows how to work with SpatialTransformer ?
well, im trying to animate the rotation of a box … but thing is I cant control the box (move it) after running the SpatialTransformer for rotation
any working code will be useful
You can also use SpatialTransformer to control the position by using its setPosition() method, much the same way the rotations are controlled in the HelloAnimation example.
well you see, Im trying to make a small game, very similar to TestPong, with a small change that a player can rotate his box 90 degrees when he presses a certain button, to hit the ball and give it more velocity
I tried to do this using the SpatialTransformer, but the rotation/movement is becoming faster each time the player hits the button
I guess SpatialTransformer is not the best solution for my problem?
Have you tried working through the Flag Rush tutorials in the wiki? They may take you a day or two, but it will be a good introduction to many of jME's features and will help you to understand the mechanics of what you are wanting to do here.
i guess ur right … I'll take a deep look through this tutorial and get back …
thanks