Hello, after many attempts in a shooter game test in first person, I can load a weapon and walk so I 'm very happy but now I don’t have idea how to do for gestion of: mouse-weapon-sign and cam
when I move the mouse. Actually I just walk and the sign is fix in front of the player I wanna move the player like this:
http://www.youtube.com/watch?v=M6021QkCDUw
this is the player code
[java]
private void initPlayer(){
flyCam.setMoveSpeed(100);
CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
player = new CharacterControl(capsuleShape, 0.05f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(0, 100, 0));
bulletAppState.getPhysicsSpace().add(player);
sword = (Node) assetManager.loadModel("assets/saiga.blend");
sword.setLocalScale(0.5f, 0.5f, 0.5f);
sword.rotate(0,-FastMath.HALF_PI,0);
sword.move(-1, -2, 4);
cn = new CameraNode("first person camera node", cam);
//add all at node
playerNode = new Node("player node");
playerNode.addControl(player);
player.setPhysicsLocation(new Vector3f(0, 100, 0));
playerNode.attachChild(sword);
playerNode.attachChild(cn);
rootNode.attachChild(playerNode);
}
//and sign
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
[/java]
Anyone can help me? thanks in advance:)