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

Ball Collider Fails to Interact with HeightfieldCollider in React Three Rapier #564

Open
itdat opened this issue Dec 1, 2023 · 0 comments

Comments

@itdat
Copy link

itdat commented Dec 1, 2023

I am encountering an issue in React Three Rapier where a BallCollider passes through a HeightfieldCollider without any collision detection. This issue does not occur when the HeightfieldCollider is replaced with a CuboidCollider, where the BallCollider correctly collides and stops.

The setup consists of two RigidBodies, one with a BallCollider and the other with a HeightfieldCollider. The BallCollider is set with a dynamic type and positioned above the HeightfieldCollider.

Here's a snippet of the relevant code:

<Physics debug>
      <RigidBody type="dynamic" position-y={100}>
            <BallCollider args={[5, 5]} />
      </RigidBody>
      <RigidBody type="fixed">
             {/* <CuboidCollider args={[100, 1, 100]} /> */}
            <HeightfieldCollider args={[3, 3, [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2], { x: 80, y: 1, z: -80 }]} />
      </RigidBody>
</Physics>

The expectation is for the ball to collide and interact with the heightfield surface. However, in practice, the ball passes through the heightfield collider as if it's not there.

This behavior is observed consistently and can be replicated using the above code. Interestingly, when the HeightfieldCollider is replaced with a CuboidCollider, the ball behaves as expected and stops upon collision.

Here is a screenshot illustrating the issue:
image

I am looking for insights into why this might be happening and how to resolve it. Is there a specific configuration that I am missing, or could this be a potential bug in the library? Any help or guidance would be greatly appreciated.

Thank you!

@itdat itdat closed this as completed Dec 1, 2023
@itdat itdat reopened this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant