How to store a RigidBodyControl's "momentum" and setting it back to it later on?

Hi,

Does anybody know how to store the “momentum” of a RigidBodyControl in variable(s) so that let’s say a ball rolls on a terrain and I detach it and like a minute later I re-attach the geometry along with a new RigidBodyControl, so that it continues EXACTLY where it left off but with it’s momentum, meaning if it was falling, it pickups up exactly with the right amount of downwards acceleration etc…?

I’m looking for something just like storing its position vector and then setting it back using: dat_node.getControl(RigidBodyControl.class).setPhysicsLocation(vec3_backup_position);

Is there a way of doing the same for all the forces/acceleration of a RigidBodyControl?

Thx :smiley:

Actually, I realized something and I think I’ll go with this; that’s the behavior I was looking for, so I’ll share my own solution, maybe somebody not realizing it will find this useful:

It’s less trouble and probably same performance if not even faster to just keep the node as is with the RigidBodyControl and everything in RAM (in a Node variable as usual) and only setting the RigidBodyControl.setEnabled(false) which freezes the PhysicsSpace right there (not processing any collisions or anything) and culling the geometry to make it hidden (or if there were thousands of those, I could have simply detached them from the rootNode instead of culling them to save some performance) and voila. When I want it back so that it continues where it left off, I simply set the RigidBodyControl.setEnabled(true); and uncull the geometry (or re-attach them if there are thousands of them as previously mentionned) to make them visible.

That’s it. It was simpler than I thought at first glance.