Zero gravity - Model still falling

I have a PhysicsCharacterNode, set a (0,0,0). I want zero-gravity, so the PCN should remain at (0,0,0).

First, I set up the bulletAppState:

[java] bulletAppState = new BulletAppState();



Next, I setup the player:

[java] // Load the model

Spatial playerMesh = assetManager.loadModel("Models/Cube.j3o");

// Find out correct shape measurements.

CapsuleCollisionShape playerCollisionShape =

new CapsuleCollisionShape(1.5f, 6f, 1);

// Create a the player Node

player = new PhysicsCharacterNode(playerMesh, playerCollisionShape, 0.005f);

player.setUpAxis(1); // Y





// Set it up to look approriately


player.setLocalTranslation(0, 0, 0);

// Attach the player to the root node



Still, when I run my game, the ship falls down the Y-asis. Any clues on why this is happening? Am I missing something or is there a bug somewhere?

To answer my own question, you should set stepHeight to 0f for ‘floating in zero gravity’ objects:

[java]player = new PhysicsCharacterNode(playerMesh, playerCollisionShape, 0.0f);[/java]

No, the stepheight only gives the “quantization” for the up/down movement so if you set it to zero, it cannot move up or down. Generally the physics character is only a simple physics simulation. If you want “real” no-gravity behaviour etc. you should use PhysicsNodes.

So what if you want your character to Swim under water? You’d like no gravity and the possibility to swim up or down.

Are you then tied to using a full PhysicsNode or is there a trick for that with PhysicsCharacterNode?

Uhm, ariejan said setting the character gravity to zero wont work, so I’d probably just add a y-component to the walkDirection to make it hover.

I tried it but it doesnt seem to work. You will need the actual falling speed, which you don’t know. Also gravity is an acceleration.

While setting gravity or fallingSpeed to zero doesn’t do anything, i found that you can set it to very low numbers.

What seems to work to effectively stop falling is