appsinacup / godot-rapier-physics

Godot Rapier Physics – A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids.
https://godot.rapier.rs
MIT License
348 stars 17 forks source link

Rapier incorrectly returns null on state.GetContactColliderObject #102

Closed Scuas closed 3 months ago

Scuas commented 4 months ago

Describe the bug state.GetContactColliderObject in _IntegrateForces returns null when it should return a valid node.

To Reproduce Steps to reproduce the behavior: Create a c# rigidbody script with the following and run collisions with it (make sure contact monitor is enabled).

 public override void _IntegrateForces(PhysicsDirectBodyState2D state)
    {
        if (state.GetContactCount() > 0)
        {
            GD.Print("object: ",state.GetContactColliderObject(0));
        }
        base._IntegrateForces(state);
    }

If using the example project: Download rapier2D and switch physics engines, hit play. You will notice that the output changes depending on engine used.

Expected behavior The output should read "object: Rigidbody#" when a contact is detected.

Environment (please complete the following information):

Example project(zip) rapierexceptionsissue.zip