Disable entity

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Posts: 12
Joined: Sat Oct 13, 2018 1:40 am

Disable entity

Post by PhilipArthurMoore » Mon Jan 28, 2019 4:41 pm

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?

Site Admin
Posts: 4894
Joined: Tue Jul 04, 2006 4:45 am

Re: Disable entity

Post by Norbo » Mon Jan 28, 2019 7:52 pm

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.

Post Reply