Node Rotation Constraint and parenting?

I am currently making a fps game. I made the player node have the BetterCharacterControl, then I added a headNode as a child of the player node. The problem I have is that I can’t make only the head rotate, because either I set the camera as a child of headNode, and thus the rotation is forced by the player node, or I set the camera as parent of headnode(but this forces me to make a position loopback to the camera and this create weird effect when objects are attached the the headNode).

I also tried adding a camera node with the cameraToSpatial and the SpatialToCamera and its not doing what I want.

So, is there a way I can make the camera translate(so the headNode translate too) using the player node position and rotate using the camera rotation?

Also, putting translation in the update loop is not viable because the objects are not following fast enough(if I move right, my headnode and its childs is not keeping up and is having a left offset until I stop walking)

Thanks in advance!

You can try not to do parenting, just make the camera follow the player by setting its location as per the player location, and play with rotation and location, however you want.

Check Hello Collision tutorial
http://wiki.jmonkeyengine.org/doku.php/jme3:beginner:hello_collision

Then you put it in the wrong part of the update loop.

What do you mean? I just put it directly in the SimpleUpdate method from SimpleApplication.
Where should I put it?

Nvm I finally got the head to move like I wanted! Thanks anyway :smile:

Hard to say without knowing your code.
But there are two locations where you typically hook in:

@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}

@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}

And then there is Control and AppState which also each have an equivalent to update() und render().

The update loop is big … with many places where you can inject your code.

And it depends on your code and the order in which you write commands.
And the code is open source - jME is a white box, not a black box - just download the code and set up an IDE project. Or if you prefer a black box then read the wiki and the javadoc.

simpleUpdate() is one of the very first things called. So any control updates, app state updates, etc. will happen after that. Some searching through the forum or code… or some logging can tell you when things happen in update.