PhysicsNode replacement

Hey guys,



up until now I’ve always been using an instance of a PhysicsNode with a Geometry and some ParticleEmitters as its children. Whenever I’d apply a force to the PhysicsNode, it would also move the Geometry and the Particles. Since the PhysicsNode is deprecated however, I wanted to replace it with the RigidBodyControl which I add as a Control to the Geometry - but this would mean I can no longer Group the Geometry and the Particles together, since the Geometry does not take any children. So I figured I’d group Geometry and ParticleEmitters together by using a Node and adding the RigidBodyControl to that - but since the node is no Geometry (and the RigidBodyControl is not looking for a Geometry instance in the Nodes children), I get no collisions.



So how do I properly replace the PhysicsNode using the new semantics of RigidBodyControl?



Btw. RigidBodyControl does not have any applyContinuous* fns (even though they are mentioned in the docs of the apply* fns).



Would be glad to get an answer.



kind regards,

mhooo

You can still use the CollisionShapeFactory as before, and actually the RigidBodyControl uses it too, so you should get collisions if there is just Geometry in an added Node. Applycontinuous was removed because it would have required an extra loop through all objects and never was abullet function, its easy to replace by just calling applyForce each tick. But I have to remove the references from the javadoc, yeah.

Ah yes, after some trying it turns out you are right. But it seems my code is at fault. Basically the internal bullet objects position is not being set properly, which is why I thought collisions did not work. If I first call setLocalTranslation on the node containing my geometry and then add the RigidBodyController calling addControl on the node, the geometry has a correctly translated position - but the internal bullet object stays at the world origin. How can I fix this behavior?

You could set the control to kinematic mode, as of the latest nightly this applies the spatial location to the physics. Otherwise use spatial.getControl(RigidBodyControl.class).setPhysicsLocation().