Skip to content

Let scripts disable collisions between two actors #856

Description

@Gopmyc

Problem this feature should fix

Nothing can stop two specific actors from colliding. PhysicsEngine::Consider adds every body with m_world->addRigidBody(&body), without collision group or mask, and there is no layer system anywhere in the engine.

The workarounds are all global : SetTrigger drops the contact response against everything, SetEnabled(false) takes the body out of the world. Nothing says that a projectile ignores the actor that fired it, or that two vehicles pass through each other while still colliding with the rest of the scene.

Expected solution

A per pair ignore on PhysicalObject, exposed on the component in Lua :

bullet:GetPhysicalObject():SetIgnoreCollision(shooter:GetPhysicalObject(), true)

Bullet already has btCollisionObject::setIgnoreCollisionCheck, so the engine side is a wrapper over it.

Two points to settle : the ignore list lives on the btRigidBody, which RecreateBody throws away on a kinematic, scale or shape change, so it has to be carried over the way BodySettings carries the rest of the body state. And an ignored pair produces no contact at all, so collision and trigger events stop firing between the two

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions