Matter
ClassSettings for the physical substance, such as friction and bounciness, of a collider.
- Available on all platforms
Since Lens Scripting v169
Settings for the physical substance, such as friction and bounciness, of a collider. If unset, uses the default matter from the world settings.
Index
Properties
Methods
Example
// @input Physics.WorldComponent worldComponent
// @input Physics.Matter matter
script.matter.friction = 1;
var worldSettings = script.worldComponent.worldSettings;
worldSettings.defaultMatter = script.matter;
Extends
Properties
dynamicBounciness
dynamicBounciness:
number
Bounciness, or restitution, for dynamic bodies. This is the proportion of energy preserved after a collision, in the range 0 to 1.
- 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.
Since
Lens Scripting Version 169
Default Value
0
friction
friction:
number
Coefficient of friction.
- The effective friction between two objects is the product of both objects' friction.
- 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.
Since
Lens Scripting Version 169
Default Value
0.5
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
rollingFriction
rollingFriction:
number
Friction applied to rolling objects. This isn't physically realistic, but helps prevent objects from rolling indefinitely.
Since
Lens Scripting Version 169
Default Value
0.02
spinningFriction
spinningFriction:
number
Friction applied to spinning objects. This isn't physically realistic, but helps prevent objects from spinning indefinitely.
Since
Lens Scripting Version 169
Default Value
0.02
staticBounciness
staticBounciness:
number
Bounciness (AKA restitution), for static colliders. This is the proportion of energy preserved after a collision, in the range 0 to 1.
- 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.
Since
Lens Scripting Version 169
Default Value
1
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
getTypeName()
staticgetTypeName():TypeName<Matter>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<Matter>
Since
Lens Scripting Version 169
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean