Solved: Manually call physicsSpace.update


I can’t use the SimpleApplication class so I created a custom updater for the PhysicsSpace.
I try to manually call the update method of my physicsSpace but nothing move… What’s wrong ?

To update the physicsSpace I use :

I try to add a custom controller in the PhysicsSpace :
physicsSpace.add(new SimpleController());

I the controller I have the default update method where I put a simple log to know if the method is called:

public void update(float tpf) {

The message is never called !
My SimpleController extends AbstractPhysicsControl. And I implemented the addPhysics method:

protected void addPhysics(PhysicsSpace space) {

This method is called, so it’s good…
You can see that I use a trickListener too. And the methods prePhysicsTick et physicsTick are called, it’s also good

Why is my update method never called?

Can you try with adding physicsSpace.distributeEvents(); after physicsSpace.update(tpf);

Thanks for the quick response!
I tried to call distributeEvents… But it still doesn’t work :confused:

Should I manually call update ?

Note you can only add PhysicsControl or Spatial with PhysicsControl


My SimpleController extends AbstractPhysicsControl.
And AbstractPhysicsControl implements PhysicsControl.
So normally no problem ?

I found !!! :grinning:
It’s only the Spatial that call the update method !
( at line 736)

Thanks @Ali_RS


You’re welcome

btw, this is an example of using PhysicsSpace directly, outside of BulletAppState. You might find it helpful

The whole demo is here

1 Like


…or any RigidBody, etc… you can use JME’s bullet without ever creating a Control.

You beat me to it.