Prevent a RigidBody2D from penetrating into a Kinematic2D moving platform's CollisionArea2D

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

I have a perfectly aligned sprite and CollisionArea2D making a moving platform in Godot. Even so, a RigidBody2D sitting on top of the platform seems to sink into the kinematic body.

As you can see, the ball has penetrated inside the block. The ball is a RigidBody2D with default properties and gravity. The red block is a kinematic body that moves vertically.

Here is the kinematic body:

extends KinematicBody2D

var speed=100

func _physics_process(delta):

If I set slow speed low, like below 50, it doesn’t penetrate. How can I remove the penetration at higher speeds?

:bust_in_silhouette: Reply From: Drawsi

The problem is likely created by the collision box you’re using. Make sure both of them work fine. Also, try to avoid circles with other polygons for a while. They don’t play nice.