PxRigidBody instead of PxRigidDynamic

Hi, recently I’ve been trying to bring PxArticulation into UE4 and so far everything is going fine, a bit hacky, but fine. You can see the motivation behind it in this recent discussion I’ve had with Ori Cohen.

The obstacle I’m facing now is the fact that FBodyInstance casts the rigid actor to PxRigidDynamic when needed. The thing is, PxRigidDynamic is a subclass of PxRigidBody and 90% of these casts could be replaced with a cast to PxRigidBody.

That would be incredibly useful since the other subclass of PxRigidBody is PxArticulationLink, what I’m currently working with. Getting mass, velocity, transform, adding forces and other stuff only work for PxRigidDynamic right now, but could work with PxArticulationLink simply by replacing those casts.

Is that feasible?

Hi,

I think this is a good change. Would you add a new function called GetPxRigidBody() ?

I agree that in most cases this would suffice. I would pay special care when the logic may be relying on a NULL check to make sure this is not a static object, but again in most cases I think you’d be safe to make this change. If you do this, please submit a pull request and I can merge it so you don’t have to maintain it yourself.

I’ve just submitted it, thanks Ori.