Hello everyone,
I have a piece of code (a spell which can manipulate objects) which disable the physic (saving and removing the PhysicWorldIndex).
Then I enable it back (restoring the PhysicWorldIndex), but there is no longer any collisions with the entity (even though it's in the BuildPhysicsWorld).
Same thing when I just swap the index value (not removing the component), looks like the index method wasn't a proper one (or I'm just stupid, which I would prefer).
Any ideas ?
Thanks !
#Disable and enable back physic on an entity
1 messages · Page 1 of 1 (latest)
You can try disabling/enabling the component using SetComponentEnabled instead of removing/adding components or changing them.
You can also try to disable the PhysicsCollider and PhysicsMass components.
I'm not really sure of the proper way to enable/disable physics.
I'm not sure about what you mean by it, because none of them are IEnableableComponent 😣
Ah right, my mistake. Ignore me 😄
(assumptions)
okay 😂 thanks anyways ^^
@lethal marlin A workaround. Turn the object to kinematic and set collision response to none.
As in, remove PhysicsVelocity
and
physicsCollider.ColliderPtr->SetCollisionResponse(CollisionResponsePolicy.None);
I'll remember the collision response thanks !
But yeah the other approach was to remove physic mass, velocity (maybe dampling) and any interpolation components. WorldPhysicIndex was know as being the way to go instead of this. But I'll do it if nobody tell me how to fix it ^^
Yep 👍 on the WorldPhysicIndex. I thought it was the way to go as well. Weird that it doesn't re-enable the physics.
Maybe it should and I'm just doing bad things u.u