Description

Contact point between two colliding objects. See also: ColliderComponent, CollisionEnterEventArgs, CollisionExitEventArgs, CollisionStayEventArgs.

Example

// Print out information about each contact point when the collider enters a collision

// @input Physics.ColliderComponent collider

script.collider.onCollisionEnter.add(function(eventArgs) {
var collision = eventArgs.collision;
var contactCount = collision.contactCount;
var contacts = collision.contacts;
for (var i = 0; i < contactCount; ++i) {
var contact = contacts[i];
print("contact[" + i + "]: distance=" + contact.distance + ", impulse=" + contact.impulse);
}
});
interface Contact {
    distance: number;
    impulse: number;
    normal: vec3;
    position: vec3;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
}

Hierarchy (view full)

Properties

distance: number

Description

Distance along the normal between the hit collider and this collider.

impulse: number

Description

Impulse (kg*cm/s) applied along the normal in response to the collision.

normal: vec3

Description

Normal on the hit collider.

position: vec3

Description

Position on the hit collider.

Methods

  • Returns string

    Description

    Returns the name of this object's type.

  • Parameters

    • type: string

    Returns boolean

    Description

    Returns true if the object matches or derives from the passed in type.

  • Parameters

    Returns boolean

    Description

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Generated using TypeDoc