0 votes

So I made this box in a RigidBody that the Player can push it on, but it is very light and the player pushes very easily, and when the player climbs it, the box "sinks" into the tilemaps below; I just created the box without setting anything in RigidBody, leaving everything as default; what is the best way to approach this? Was it making the box with RigidBody anyway? Or is there any better method?

Thanks guys

in Engine by (174 points)

What kind of body is your Player?

Kinematic Body, working with a moveandslide for Inputs

1 Answer

+2 votes
Best answer

That explains it. move_and_slide() has a parameter called "infinite inertia", which is enabled by default. This means that the kinematic body pushes the rigid body regardless of its physics properties.

First, you need to set this to false, at which point your player will just stop when hitting the rigid body.

Then you need to, upon collision, apply an impulse to the rigid body based on your player's desired effective "mass".

You can see a more complete explanation of this interaction with examples here:

by (21,940 points)
selected by

tks KCC, you are my hero

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.