Modications JPhysics


i need some help by jmonkey experts.

One of my classes needs to be informed, anytime a spatial inside a scene is modified by JPhysics.

If this happens, i would like to invoke a method of a singleton object and pass the spatial which has changed.

Is there any way to stay informed about modifications done by JPhysics2, of course without modifying the JPhysics-Sources :).

thanks in advance


What kind of modifications do you want to listen for? There is already a contact callback that gets called when a contact/collision occurs.

I think, i need to be informed about every postition modification done by physics. Does a contact Callback invoke after modificiations due to gravity? …without any collision?

How can i use this callback?

There is an example in the test package for jME Physics 2. But you may be more interested in the PhysicsUpdateCallback interface used by PhysicsSpace.addToUpdateCallbacks().

Thanks for your answer, it  helped us much to gain an insight to the physics engine. but we cannot use Physics Callback the way we need to.

Perhaps we were focused on the physics engine too much. so i posted our problem a little bit more specific to General Forum. There is also an answer why we can`t use PhysicsCallback.

Please read more about our problem here