0 votes

Hi there,

I try to implement a box pushing mechanic.

You can see a gif of my problem here.

So I have two problems :)

  1. after I touch my statue (RedgidBody2D) with the Pig (KinematikBody2d) the statue never stops sliding. How do I stop this heavyweight stone Object correctly?

  2. I can push the statue with the Pig inside of the map walls. Is there a way, so the statue cannot be pushed in the wall?

I like Godot (using 3.1-alpha currently) a lot but I just get stuck in those physics, colliding, area stuff all the time -.-

Thanks for any help in advance.

Tom

in Engine by (23 points)

1 Answer

+1 vote
Best answer
  1. Have you set the RigidBody2D 's linear damping to a value greater than zero? That's how I simulate floor friction for top-down views like the one from your gif.
  2. If the statue doesn't collide with the stone walls, that could be one of a couple things. Check:
  • Statue should be a RigidBody2D.
  • Wall should be another rigid body or (more likely) a StaticBody2D.
  • Statue and wall bodies need shapes (check by enabling collision shapes in debug menu).
  • collision layers for the statue and the wall have to match up. You probably have player, wall, and statue all on the same layer and with the same mask.

Or do you mean that the statue does collide with walls correctly, but then you can push it into walls using the pig? If that's the case, then the issue is that the physics engine (purposefully) never prevents a kinematic body from moving - the physics engine will never stop the pig from pushing the statue, even if the statue ends up in a wall. You will have to change the pig to not be a kinematic body (I use rigid bodies even for player controlled physics objects) or add some code to recognize when the pig is about to push the statue into the wall and prevent that somehow.

by (629 points)
selected by

Thank you and sorry for my late response (found it in my spam filter -.-)

For the sliding statue problem: The linear dump was on 100+ and nothing worked. My mistake was, that I toggled Custom Integration to On so linear dump had no effect. Now the Statue stops sliding.

And the integration of integrateforces did the trick with the push through the walls issue.

So thank you for pushing me to the right direction^^

glad you found the solution, even if it wasn't mine :D I'll have to remember that about custom integration to suggest about problems like this.

Can you provide more information how you solved this with integrate_forces? I am having the same problem (a kinematic player is able to push a rigidblock block through a wall, which should not happen)

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 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 webmaster@godotengine.org with your username.