Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected impulses using Characterbody2D and RigidBody2D #354

Open
suumpmolk opened this issue Mar 7, 2025 · 0 comments
Open

Unexpected impulses using Characterbody2D and RigidBody2D #354

suumpmolk opened this issue Mar 7, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@suumpmolk
Copy link

suumpmolk commented Mar 7, 2025

This may or not may be a bug, but I'm hoping to get some assistance improving this behavior in my game.

Image

Using regular Godot physics, if the RigidBody2D does not have the player in its collision mask, the RigidBody2D is not affected at all by the player. I don't know if this is supported with Rapier but it doesn't seem like it. The issue I'm having is that the player is able to push the RigidBody2Ds in somewhat unexpected and explosive ways.

To Reproduce

Steps to reproduce the behavior:

  1. Download the example project.
  2. Add the Rapier addon (I used Fast 2D)
  3. Enable Debug -> Visible Collision Shapes
  4. Start the main scene and jump up and down the blocks (see the attached videos).
    Focus on jumping up the blocks and try to push the blocks to the right.

This process can take a minute depending on your luck(?). Sometimes it happened on the first try after starting the project.

https://github.com/user-attachments/assets/049c6652-1a1a-4731-8555-469a4589d2e9
https://github.com/user-attachments/assets/0872c28e-97ce-478b-b04f-747411f32331

Expected behavior

I am hoping to get one of the following behaviors:

  1. The RigidBody2D is not affected at all by the CharacterBody2D
  2. The CharacterBody2D is affecting the RigidBody2D in a less explosive and predictable way.

I am uncertain how a CharacterBody2D is expected to affect a RigidBody2D. It has no configurable mass etc. Is it just depending on the velocity how much it is pushing the RigidBody2D?

Environment:

  • OS: Windows
  • Version: 0.8.8
  • Godot Version: v4.3
  • Type: 2d-single-simd-parallel

Example project(zip)

rapier-characterbody2d-impulse.zip

@suumpmolk suumpmolk added the bug Something isn't working label Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant