RigidBody2D is moving KinematicBody2d (how to prevent?)

KrawllKrawll Posts: 2Member

Godot version:
v3.0.6 stable
Steam Version

I am making a tetris-like where I need a RigidBody2D(ball) to bounce off of KinematicBody2D(the tetromino). I need to use the KinematicBody2D for the move_and_collide() so that it stops when it runs onto other pieces or the bottom platform(StaticBody2D). I honestly don't understand why there is no toggle for this. I can do this the long and hard way but would prefer to use Godot's built-in physics as I am new to programming to begin with.

If there is another way to approach this I am all ears but no matter how much I search for this topic I could not find an answer.

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 1,000Admin

    I think you can just change the collision mask to turn off collisions for the objects once they are in place. This page on the documentation explains how the collision layer/mask system in Godot works. To be fair, the collision layer/mask system is rather confusing, and I have been using Godot for quite awhile now.

    That way you could either move the objects when you no longer want them to collide to a different collision layer, and/or you could change the collision mask so that it no longer detects collisions.

    Another thing you can potentially do is disable the collision shape(s) of the objects once you no longer need them. You just need to set the disabled property to true in the collision shape nodes and then they will no longer be used to process collisions.

    Hopefully one of those methods will stop them from colliding with each other :smile:

  • KrawllKrawll Posts: 2Member

    I will give those a try. Thanks for the response!

Sign In or Register to comment.