Trouble is connected with camera. Be shortly - when you look down and press key “S”(to go back) you just starting fly. And second - when you rotate camera down you go through your “legs place” and find your self on head. How to fix this. I have ide to set some restrictions on cam angle but how can i see what i angle for? Is there some debug tool of this kind of information?
disable the flycam
Yes i noticed that bug too
Can also add [java]walkDirection.y = 0;[/java] before [java]player.setWalkDirection(walkDirection);[/java]
How to disable flycam?)))
walkDirection y=0 is not working
Not sure if you get me,
your update method should look like this:
[java]public void simpleUpdate(float tpf) {
Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);
Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);
walkDirection.set(0, 0, 0);
if (left) { walkDirection.addLocal(camLeft); }
if (right) { walkDirection.addLocal(camLeft.negate()); }
if (up) { walkDirection.addLocal(camDir); }
if (down) { walkDirection.addLocal(camDir.negate()); }
walkDirection.y = 0;//only this is added
player.setWalkDirection(walkDirection);
cam.setLocation(player.getPhysicsLocation());
}[/java]
yeah and thi is does not work properly, i gain fly and can go throug objects
Hmm, are you shure u have the same code as in tutorial, because i just built it again, and its working (well not that part where you can get upside-down if you rotate camera, but that is completely different story)
yeah the same code i dod not change anything except light color maybe)
Hmmm i wrote this line again an thi is working…
I was experiencing the same problem, and it turns out that landscape is having a gravity vector applied to it after adding it to the physics space. So you’re not actually ‘flying’, the ground is just falling faster than you are!
Here’s what the correct code should look like
[java] rootNode.attachChild(sceneModel);
bulletAppState.getPhysicsSpace().add(landscape); // <-- Sets gravity for landscape
landscape.setGravity(new Vector3f()); // <-- Disables gravity for landscape
bulletAppState.getPhysicsSpace().add(player);[/java]
Hi all, i seem to be having the same problem, even to the point that i have copied and pasted all the code exactly from the tutorial but i seem to be flying everywhere and through eveything as if no physics or collisions were present