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

// 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);
}
});

Hierarchy (view full)

Constructors

Properties

distance: number

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

impulse: number

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

normal: vec3

Normal on the hit collider.

position: vec3

Position on the hit collider.

Methods

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

    Parameters

    • type: string

    Returns boolean

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

    Parameters

    Returns boolean

MMNEPVFCICPMFPCPTTAAATR