Description

Settings for the physical substance, such as friction and bounciness, of a collider. If unset, uses the default matter from the world settings.

Example

// @input Physics.WorldComponent worldComponent
// @input Physics.Matter matter

script.matter.friction = 1;
var worldSettings = script.worldComponent.worldSettings;
worldSettings.defaultMatter = script.matter;
interface Matter {
    dynamicBounciness: number;
    friction: number;
    name: string;
    rollingFriction: number;
    spinningFriction: number;
    staticBounciness: number;
    uniqueIdentifier: string;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
}

Hierarchy (view full)

Properties

dynamicBounciness: number

Description

Bounciness, or restitution, for dynamic bodies. This is the proportion of energy preserved after a collision, in the range 0 to 1. This defaults to 0.0. Dynamic bounciness should usually be less than 1.0, to prevent energy from accumulating excessively (there is a certain amount of energy gained due to collision response). The effective bounciness for a collision is the product of both colliding objects. So if your bounciness setting appears to have no effect, it probably means the object it's colliding with has 0 bounciness.

friction: number

Description

Coefficient of friction. The effective friction between two objects is the product of both objects' friction. So for example, the default between two objects is 0.5*0.5=0.25. Typical ranges are between 0 and 1, but larger values (up to 10) are allowed. This may be used to increase the effective friction when colliding against another object with low friction. This is a very simplified approximation of realistic friction, since it does not correctly take into account the combined surface characteristics of both objects. It also doesn't distinguish between static and dynamic friction.

name: string

Description

The name of the Asset in Lens Studio.

rollingFriction: number

Description

Friction applied to rolling objects. This isn't physically realistic, but helps prevent objects from rolling indefinitely.

spinningFriction: number

Description

Friction applied to spinning objects. This isn't physically realistic, but helps prevent objects from spinning indefinitely.

staticBounciness: number

Description

Bounciness (AKA restitution), for static colliders. This is the proportion of energy preserved after a collision, in the range 0 to 1. This defaults to 1.0. Typically we use high bounciness for static colliders because they are unaffected by collision, and thus maximally preserve energy. The effective bounciness for a collision is the product of both colliding objects. So if your bounciness setting appears to have no effect, it probably means the object it's colliding with has 0 bounciness.

uniqueIdentifier: string

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