KinematicBody2D player colliding with RigidBody2D

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

Sorry if i say something really dumb or obvious, i’m new to this game engine and to GDScript.

I have a simple KinematicBody2D player that moves left and right, and jumps. And an inanimate RigidBody2D node that doesn’t have any behavior yet, so it’s only affected by the engine physics. Since the rigid body is small compared to the player, i want the player to ignore the rigid body’s force, and the rigid body to be affected by the player’s actions. Right now the player just gets stuck when the rigid body falls above it.

May the solution to this be changing the player into a RigidBody2D as well?

May the solution to this be changing the player into a RigidBody2D as well?

That could be one of them. But maybe the problem is that you are using move_and_collide instead of move_and_slide. Are you?

SIsilicon | 2018-05-26 18:17

I’m using move_and_slide.

Using Kinematic is much more easier than using Rigid, but my character is supposed to act like a physical object affected by external forces that can rotate, rather than a typical platformer player. Maybe i’d just have to recode it to Rigid, it’s just that the ‘‘is on floor’’ function is pretty useful and it doesn’t seem to find it in Rigid.

SqrtTwo | 2018-05-27 22:16

:bust_in_silhouette: Reply From: SIsilicon

Well now I think you should use a rigid body. You just need some changes to your code.

You should go check out the 2D physics platform demo.