I’m trying to mix real world data from position and orientation sensors with a PhysX simulation.
Which means that I want my bodies that mimic the real world ones to influence (collide etc) the virtual bodies but I don’t want the purely-virtual bodies to exert any influence/forces to the “real” ones (in a way, the “real” bodies should behave like static bodies, but can be moved).
I already know how to disable gravity from my objects, which makes it easier to move them, but they are still pushed by the virtual-only bodies on collision, have inertia and everything else.
Has anyone done this before? Any ideas on how to approach this issue?
I’m using PhysX 2.8.4
Thanks.
Apparently in physics simulation the type of objects that I’m looking for are called kinematic objects.
So it seems that the best way to do what I want is to declare my purely-virtual objects as dynamic objects (as I was already doing) and my “real”-objects as kinematic objects.
I still have no idea of how to do this in PhysX, as such, any help on how to do that would be greatly appreciated.
Yeah, you would need kinematic for your real world bodies and dynamic for the purely-virtual.
Check out NxActor::raiseBodyFlag(NX_BF_KINEMATIC) in the samples.
To create a kinematic actor, first create a dynamic actor, and then set its kinematic flag either in the body descriptor or with NxActor::raiseBodyFlag(NX_BF_KINEMATIC). When you want the kinematic actor to become a normal dynamic body again, turn off the kinematic flag with clearBodyFlag(NX_BF_KINEMATIC). While you do need to provide a mass for the kinematic body as for all dynamic bodies, this mass will not actually be used for anything while the actor is in kinematic mode.