Making node move/rotate with cam

I was just messing around with basic objects to make a hand… I know I am board… So I made this funny hand and attached it to that cam but I have no I idea how to make the node rotate and move a bit to make it look a little better here is what I made: http://scar.zapto.org/java/tmp/TestRoomBlast2.java and please try no to laugh :wink:

I think I should some how use a nodehandler to make the hand move with the camera, but I don't know how.

Try out CameraNode wich moves Your camera as well as any other stuff atached to it.

See jmetest.renderer.TestCameraNode for an example.

I made a lot of mess when I tried to add node to the camera handlers and the parts that builds the camera handlers (like MouseLookHandler,MouseLook,KeyLookDownAction…)  :expressionless:



winkman I tried what you told me to look at and it work more or less, just have to get the hand to turn arround…

http://scar.zapto.org/java/tmp/TestRoomBlast4.java

to turn the hand node 180 degrees, in private void bouRHand() add something like:



//maybe You want to use less than 180 degrees to better see the hand

rhand.getLocalRotation().fromAngleNormalAxis((float)Math.toRadians(180), new Vector3f(1, 0, 0));



where the Vector3f defines the axis of rotation and the float defines the amount of the rotation



or use setLocalRotation(…) instead



… and I think in Your case You don't need rhand.updateWorldBound() at all.

yesterday I obviosly tried getting it right to make it turn around but everytime I tried it messed up a lot like one i tried a matrix3f and the whole hand was scattered all over the place :-o now I tried winkman's way and it worked again :slight_smile: but there is still (again) some thing I have to change its pointing in the right direction but its upside down I am now going to try and fix it by my self… can't make winkman do everything :smiley:

ps: I forgot to add the link http://scar.zapto.org/java/tmp/TestRoomBlast6.java and one is actually a typo "messed up a lot like ONCE i tried" I now noticed that there is not "edit" for a post you made and also noticed that I am quite dependant on it ://

That was realy easy its not upside down anymore set

(rhand.getLocalRotation().fromAngleNormalAxis((float)Math.toRadians(180), new Vector3f(1, 0, 0));)


to

rhand.getLocalRotation().fromAngleNormalAxis((float)Math.toRadians(180), new Vector3f(0, 1, 0));



Can "sonemone" expain to me why the node messes a bit up if i set the vector to (0,0,0) ? or is that a bit to complex to explain?