Hello!
This topic is linked to: http://www.jmonkeyengine.com/jmeforum/index.php?topic=6774.0
But as it does not concern Phisics, this part of the problem sits here in the General forum.
I'm trying to make a physical body for the first person "player". If you have any suggestion or tutorial related to making 1st person camera or else, I'll be glad to get them…
So! Situation now: I have two parts for my "player": Body and head, both are DynamicPhysicsNode.
- The body must be able to turn left/right using the mouse
- The head must be able to look up and down using the mouse
But looking up/down must be prohibited for the body node while the head node may not turn left right. I hope it makes sense.
I'm stuck with mouseLook.setLockAxis - I've made two "custom" handlers based on NodeHandler:
- one for the head: HeadNodeHandler
- one for the body: BodyNodeHandler
I can't figure out how to modify the NodeHandler class to that end.
The following code seems to control the mouselook:
private void setUpMouse( Spatial node, float mouseSpeed ) {
RelativeMouse mouse = new RelativeMouse("Mouse Input");
mouse.registerWithInputHandler( this );
NodeMouseLook mouseLook = new NodeMouseLook(mouse, node, 0.1f);
mouseLook.setSpeed( mouseSpeed );
mouseLook.setLockAxis(new Vector3f(node.getLocalRotation().getRotationColumn(1).x,
node.getLocalRotation().getRotationColumn(1).y,
node.getLocalRotation().getRotationColumn(1).z));
addAction(mouseLook);
}
Ow :?
There's also that setActions method.
I'm tempted to ask: "Where should I modify what?"
Please help...