Page 1 of 1

Disable entity

Posted: Mon Jan 28, 2019 4:41 pm
by PhilipArthurMoore
HELLO
I want to disable/enable entity in Space:
+ if Entity is disabl, it will not be effected by physic
+if Entity is enable, it will be effected by physic
And i dont want to use add/remove entity
How to?

Re: Disable entity

Posted: Mon Jan 28, 2019 7:52 pm
by Norbo
If by 'disable' you mean it is not interact with physics at all- no motion, no collisions, no constraints- then actually removing it is the best way.

If you instead mean 'does not respond to forces', then making the object kinematic would work. Kinematic objects have effectively infinite mass- they'll keep moving with unchanging velocity regardless of any external forces, constraints, or collisions. The only thing that can change their velocity is directly setting their velocity through code. So, if you set a kinematic's velocity to 0, it would just not move. In v1, this can be done using entity.BecomeKinematic. In v2, setting the body's local inertia to all zeroes (new BodyInertia()) does the same.