Getting a Kinematic2D to stand on a Rigidbody2D

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

I am working on a simple 2D platformer. I need the main character to be able to throw a ball and then stand on it to reach a higher area. However, when the character tries to jump on the ball, it sinks into the ground, until the character moves, and the ball rises back up. I am using a basic move_and_slide command for the kinematicbody, and nothing has been added to the Rigidbody. How can I allow the kinematic character to stand on the block?
The Jump Test

1 Like
:bust_in_silhouette: Reply From: nerdbaron

I found the answer! For anyone in the future with the same issue, I got it to work by setting infiniteInertia to false in the MoveAndSlide method. If you still want to be able to push the rigidbody around afterwards, you can play with the info from the GetSlideCollision method to get something set up.

Thanks for posting your solution, very helpful!