I'm making a card game, and I'd like to attach the players hand to the camera (or cameraNode). The cards are all 3d models. I tried the following code:
Vector3f loc = new Vector3f(0,0,30);
this.gsMain.getCameraNode().attachChild(model1);
model1.setLocalTranslation(loc);
model1.updateGeometricState(1.0f, true);
but the card isn't showing up in front of the camera. I debugged some values,
model1.getWorld: [X=48.959408, Y=109.546974, Z=238.07762]
cameraNode.getWorld: [X=50.0, Y=130.0, Z=260.0]
camera.getDirection: [X=-0.03468637, Y=-0.68176764, Z=-0.73074603]
so just by cursory examination, it looks like the model SHOULD be in front of the camera.
I guess I have some questions about exactly how the coordinates are set with the camera/cameraNode. Does the cameraNodes local coordinates align with the camera, so that +z is where the camera is looking and up/left are Y/X?
Im wondering if im going about it the wrong way. also previously the camera was transformed and aimed by this code:
this.cameraNode = new CameraNode("camDistance", this.camera);
this.cameraNode.setLocalTranslation(new Vector3f(50, 130, 260));
this.cameraNode.updateGeometricState(0, true);
this.camera.lookAt(new Vector3f(0.0057349987f, -0.7400375f, -0.672541f).normalizeLocal().mult(1000), new Vector3f(0.0063103223f, 0.6725656f, -0.74001056f).multLocal(1000).normalizeLocal());
this.cameraNode.updateFromCamera();
any help would be appreciated.