Engine API Reference - v2.23.0-beta.22
    Preparing search index...

    Class SingleContactResult

    Represents the detailed data of a single contact point between two rigid bodies in the physics simulation. This class provides comprehensive information about the contact, including the entities involved, the exact contact points in both local and world space coordinates, the contact normal, and the collision impulse force.

    Instances of this class are created by the physics engine when collision events occur and are passed to event handlers only through the global contact event on the RigidBodyComponentSystem. Individual rigid body components receive instances of ContactResult instead.

    Instances are pooled and reused by the physics system, so a result and its vectors are only valid inside the event handler that receives them. Copy any values that are needed later.

    app.systems.rigidbody.on('contact', (result) => {
    console.log(`Contact between ${result.a.name} and ${result.b.name}`);
    });
    Index

    The first entity involved in the contact.

    The second entity involved in the contact.

    impulse: number

    The total accumulated impulse applied by the constraint solver during the last sub-step. Describes how hard two bodies collided.

    localPointA: Vec3

    The point on Entity A where the contact occurred, in the local space of A's rigid body (see ContactPoint#localPoint).

    localPointB: Vec3

    The point on Entity B where the contact occurred, in the local space of B's rigid body.

    normal: Vec3

    The normal vector of the contact on Entity B, in world space.

    pointA: Vec3

    The point on Entity A where the contact occurred, in world space.

    pointB: Vec3

    The point on Entity B where the contact occurred, in world space.