In Cinematics, if I have something like this:
[java]float[] rotation = {0, 3, 0};
cinematic.addCinematicEvent(4, new RotationTrack(model[0], rotation, 1));
cinematic.addCinematicEvent(4, new RotationTrack(model[1], rotation, 1));[/java]
where
private Spatial[] model = new Spatial[drivesNumber];
why does model[0] rotates correct but model[2] rotates AROUND model[0]???
I create the spatials like this:
[java] public void create3dObjects(AnimationEvent[] eArray) {
for (int i=0; i<= spatialsNumber - 1; i++)
{
s_unit = new Box(new Vector3f(eArray.x, eArray.y, eArray.z), 1, .25f, .5f);
model = new Geometry(eArray.id, s_unit );
if(assetManager == null)
{
System.out.println("WARNING: Asset Manager is null");
}
AssetManager assetManager = null;
assetManager = JmeSystem.newAssetManager(Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"));
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Orange);
model.setMaterial(mat1);
rootNode.attachChild(model);
}
}[/java]
I just realized that model[0] is created at 0,0,0 and model[1] is created at like 6,0,0 so thats why, model[0] is rotating around itself while model[1] rotates around the y axis.
So how do I make it rotate around itself (as if it was created at 0,0,0) ?
Being continued here
http://hub.jmonkeyengine.org/groups/general-2/forum/topic/jme3-beginner-understanding-the-rotation-concept/#post-139693
don(t do this
s_unit = new Box(new Vector3f(eArray.x, eArray.y, eArray.z), 1, .25f, .5f);
create your box at 0,0,0 then use setLocalTranslation to set it to the right position.
then everything will rotate on itself