0 votes

How to nnable or disable rigid body at runtime?

asked Apr 10, 2019 in Engine by att (35 points)

1 Answer

+3 votes

Depends on what you exactly mean with disable.
https://docs.godotengine.org/en/3.1/classes/class_rigidbody.html#class-rigidbody

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...

answered Apr 10, 2019 by wombatstampede (3,185 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.