1
\$\begingroup\$

This is a self-answered question. While it might be pretty obvious, this still catched me by surprise, so I believe there is some value in this Q&A.

There is a player-controlled RigidBody2D that gets stuck between two StaticBody2D instances.

Scenario

As long as there is only a single collision between the RigidBody2D and one of the StaticBody2D's, it works mostly as expected (though I did notice high friction at certain angles, when sliding the RigidBody2D alongside the edge of the StaticBody2D).

The RigidBody2D gets stuck only if it touches both of the StaticBody2D's at the same time (as in the image above). Sometimes the RigidBody2D could be freed by the player using a high force, but sometimes not.

I made sure that friction for all bodies was set to 0.0, but the bodies still get stuck.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

It turned out the StaticBody2D's had a scale factor of 1.004 along the x-axis. This visibly unnoticable scale factor was enough to trip up the physics.

Well, I had read the physics introduction, where it's made very clear, that you should never ever scale your collision shapes:

Be careful to never scale your collision shapes in the editor. The "Scale" property in the Inspector should remain (1, 1). When changing the size of the collision shape, you should always use the size handles, not the Node2D scale handles. Scaling a shape can result in unexpected collision behavior.

Still I must have accidentally scaled the collision shape, which can easily happen when you are in scale mode and miss the handles for resizing the collision shape.

To be safe, double check that you are not in scale mode S. Use select mode Q, in which case miss-clicking only moves the collision shape, which is easy to notice. To be really safe, don't resize by mouse but type the values into the shape properties in the inspector.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .