I am currently working through the jMonkey beginner tutorials, specifically Hello Collision and have ran across a deprecated class in the tutorial, CharacterControl. I found what seems to be the most natural successor BetterCharacterControl. I have been able to modify the tutorial code to get it to compile and run but the "character", i.e. the first-person perspective, does not seem to move when i use the specified key bindings. I'm pretty sure that the issue is that i am not setting up the player correctly. here are the old lines of code from the tutorial..
CollisionShape sceneShape =
CollisionShapeFactory.createMeshShape((Node) sceneModel);
landscape = new RigidBodyControl(sceneShape, 0);
sceneModel.addControl(landscape);
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, 10, 0));
and here is what i changed it to..
com.jme3.bullet.collision.shapes.CollisionShape sceneShape =
CollisionShapeFactory.createMeshShape((Node) sceneModel);
landscape = new RigidBodyControl(sceneShape, 0);
player = new BetterCharacterControl(1.5f,6f,1);
player.setJumpForce(new Vector3f(5f,20f,0f));
player.setGravity(new Vector3f(0f,10f,0f));
player.warp(new Vector3f(0,30,0));
1) for some reason i had to add the full class name for CollisionShape
even though i am importing it earlier in the file, if anyone knows why that would be great but not a huge issue right now
2) i tried to find the most analogous methods that i could but as you can see, even though the naming is similar for some they take different arguments. I looked though the documentation but it is pretty sparse as far as explaining what each method etc actually does/is used for
3) the only other place that i changed code is in the update loop. i changed this..
cam.setLocation(player.getPhysicsLocation());
to this...
cam.setLocation(player.getViewDirection());
which doesnt seem to have caused any problems, the camera still moves as normal (atleast when standing still and panning around. as i said i havent been able to move at all)
if anyone has experience with jMonkey im sure this isnt too complicated...thanks in advance