Hi i have a proble , i cant manage to make a rotation of a Node Camera, and have some problems on rotating other childrens in side node .
//
public Geometry makeBox(){
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Red);
geom.setMaterial(mat);
return geom;
}
//
Geometry geom1=makeBox();
Geometry geom2=makeBox();
geom2.getMaterial().setColor("Color", ColorRGBA.Yellow);
Node nodeToChase= new Node("Node To Chase");
nodeToChase.attachChild(geom1);
nodeToChase.move(0, 0, -10);
Node nodeAtCenter= new Node("Node At Center");
nodeAtCenter.attachChild(nodeToChase);
nodeAtCenter.attachChild(geom2);
//
flyCam.setEnabled(false);
//create the camera Node
CameraNode camNode = new CameraNode("Camera Node", cam);
//This mode means that camera copies the movements of the target:
camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
//Attach the camNode to the target:
nodeToChase.attachChild(camNode);
//Move camNode, e.g. behind and above the target:
camNode.setLocalTranslation(new Vector3f(0, 5, -5));
//Rotate the camNode to look at the target:
camNode.lookAt(nodeToChase.getLocalTranslation(), new Vector3f(0, 1, 0));
//
myCameraManager= new MyCameraManager(camNode, nodeToChase,nodeAtCenter);
//
//
public void spinCamera(float tpf){
nodeAtCenter.rotate(0, tpf, 0);
nodeToChase.lookAt(new Vector3f(0, 0, 0), new Vector3f(0, 1, 0));
}
///
public MyCameraManager(CameraNode camera, Node nodeToChase, Node nodeAtCenter) {
this.camera = camera;
this.nodeToChase = nodeToChase;
this.nodeAtCenter=nodeAtCenter;
}
//
@Override
public void simpleUpdate(float tpf) {
myCameraManager.spinCamera(tpf);
}
some how , when i rotate central node ,his childrens dont move , and cam dont move at all.
One more thins , is while nodeAtCenter - (parent of nodeToChase)
visibli rotates , nodeToChase stay at same place and more then this a sys print , tell it has same localTranslation