CharacterControl walk direction with spherical terrain

I’m working on getting walking and moving going in my game, but I’m having trouble. The first problem is that if I use this:

[java]Vector3f lookDirection = app.getCamera().getDirection().mult(moveSpeed);[/java]

Then when the player is looking slightly up and presses W, they float upwards, or when looking down and holding S, they float up. The second problem is how to fix this. With flat-land games, it’s pretty simple:

[java]Vector3f lookDirection = app.getCamera().getDirection().clone().setY(0).multLocal(moveSpeed);[/java]

But, how would I do this with spherical terrain? I have the local “up” vector stored, (calculated by getLocation().subtract(centerOfGravity).normalizeLocal(). Works perfectly for everything else including camera-based stuff.) so that’s one thing that’s out of the way. Thanks in advance!

PS: Watch the solution be extremely simple and obvious,and I just spent 2 hours trying all the complex (and wrong) ways to do it.

Use the BetterCharacterControl. Look at the SpaceMonkey demo that comes with jmeplant. It already has all this figured out. Just have to set the gravity direction every tick.

@aaronperkins Thanks. I feel dumb now, I didn’t think about using the node’s rotation to judge walk direction instead of the camera.