How I make a heavier box using RigidBody?

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

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

What kind of body is your Player?

kidscancode | 2019-09-20 02:10

Kinematic Body, working with a move_and_slide for Inputs

lucasfazzi | 2019-09-20 02:26

:bust_in_silhouette: Reply From: kidscancode

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:
http://godotrecipes.com/physics/kinematic_to_rigidbody/

tks KCC, you are my hero

lucasfazzi | 2019-09-20 05:04