Would have posted this on the wiki, but couldnt log on.
There have been posts regarding how to define several rotations on a spatial at once, some scenarios of this have been in rotating a spatial by sending data effeciently across the net, wether to use Euler angles etc.
Simple demo showing a sptials quaternion being set with 3 new angles in one call.
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingSphere;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.scene.shape.Box;
public class TestRotateAboutPoint extends SimpleGame {
private float anglex = 0;
private float angley = 0;
private float anglez = 0;
private Box b;
/**
* Entry point for the test,
* @param args
*/
public static void main(String[] args) {
TestRotateAboutPoint app = new TestRotateAboutPoint();
app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleUpdate() {
if (tpf < 1) {
anglex = anglex + (tpf * 1);
angley = angley + (tpf * 3f);
anglez = anglez + (tpf * 36f);
if (anglex > 360) {
anglex = 0;
}
if (angley > 360) {
angley = 0;
}
if (anglez > 360) {
anglez = 0;
}
}
b.getLocalRotation().fromAngles(anglex * FastMath.DEG_TO_RAD, angley * FastMath.DEG_TO_RAD, anglez * FastMath.DEG_TO_RAD);
}
protected void simpleInitGame() {
display.setTitle("jME - Life of a rotating box");
//Planet
b = new Box("This Is A Box", new Vector3f(-25, -25, -25), new Vector3f(25, 25, 25));
b.setModelBound(new BoundingSphere());
b.updateModelBound();
rootNode.attachChild(b);
}
}
If someone could post this onto the wiki. It might help a few ...