How to nnable or disable rigid body at runtime?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By att

How to nnable or disable rigid body at runtime?

:bust_in_silhouette: Reply From: wombatstampede

Depends on what you exactly mean with disable.

You could set sleeping to true. It should then stop moving unless it is hit by something.

You could set the mode to MODE_STATIC then it stays where it is and ignores all forces but other things can still collide with it.

You could set collision_mask and collision_layer to 0 or (alternatively) disable all collision shapes of the rigidbody. Then no collision would take place.

And naturally you can toggle the visibility. It might also be convenient to link actions which I named above to a visibility notification. All depending on what you exactly want…