Disable and Enable Actor physics

LonesomeSoldier
Fri, 01 Jan 2016 19:32:46 +0000
World Creation

Hi! Happy new year!

I am working on an inventory system. I can pick up items, it is placed in my inventory, and I can drop the items back into the world, all is fine, except for one thing; the mechanism I use is to not destroy the item that is put in the inventory, but to disable it and hide it. Then upon dropping the item, I am calling SetActorLocation, putting it in front of my character. This is all well and good but, my items have physics enabled, and if the item was in motion when I picked it up, then when I drop it, it still has that physics / momentum, and it drops to the ground moving in the same direction as it was moving when I picked it up.

I found a solution for this, which is before calling SetActorLocation, I can call DisableComponentsSimulatePhysics() on the actor. That works. But then, of course, when the item is dopped, it just hangs in the air - no physics. And I do not find an equivalent EnableComponentsSimulatePhysics() method on Actor.

So my question is, how can I either 1) remove all inertia / momentum from my actor, or 2) re-enable physics after I have disabled and placed my actor?

Thanks!
PS: This is in C++.

Marius.

5 posts - 1 participant