WorldComponent
ClassGroups Physics objects in its subtree into an independent world simulation.
- Available on all platforms
Since Lens Scripting v164
Index
Properties
Methods
Remarks
All simulation occurs within a physics world, each with its own configurable settings (e.g. gravity). When a physics object is placed under a WorldComponent, it belongs to that world and will only interact with other objects in that world. By default, there exists a root-level world for the scene, but multiple worlds may be created to run independent simulations.
Example
// Change gravity in a given World Component
// @input Physics.WorldComponent worldComponent
script.worldComponent.worldSettings.gravity = new vec3(0.0, -300.0, 0.0);
Extends
Properties
enabled
enabled:
boolean
If disabled, the Component will stop enacting its behavior.
Default Value
true
Inherited from
isBeingDestroyed
readonlyisBeingDestroyed:boolean
Returns true if this Component is currently being destroyed. Becomes true as soon as
destruction begins via Component#destroy or destruction of its owning SceneObject,
before any OnDestroyEvent callbacks fire.
Since
Lens Scripting Version 364
Example
if (!script.isBeingDestroyed) {
// Component is still fully alive
}
Inherited from
isEnabledInHierarchy
readonlyisEnabledInHierarchy:boolean
Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.
Inherited from
Component.isEnabledInHierarchy
sceneObject
readonlysceneObject:SceneObject
The SceneObject this component is on.
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
updateOrder
updateOrder:
number
Update order of this world relative to other worlds (lower values are earlier). The implicit root world order is 0, so worlds with negative order will update before the root world, and worlds with non-negative order update after.
Since
Lens Scripting Version 164
Default Value
0
worldSettings
worldSettings:
WorldSettingsAsset
Reference to world settings. If not set, use the default world settings for the project.
Since
Lens Scripting Version 164
Default Value
null
Example
// Change gravity in a given World Component
// @input Physics.WorldComponent worldComponent
script.worldComponent.worldSettings.gravity = new vec3(0.0, -300.0, 0.0);
Methods
createProbe()
createProbe():
Probe
Create an intersection probe for a specific world.
Returns
Since
Lens Scripting Version 164
destroy()
destroy():
void
Destroys the component.
Returns
void
Inherited from
getSceneObject()
getSceneObject():
SceneObject
Returns the SceneObject the component is attached to.
Returns
Inherited from
getTransform()
getTransform():
Transform
Returns the Transform this component is attached to.
Returns
Inherited from
getTypeName()
staticgetTypeName():TypeName<WorldComponent>
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<WorldComponent>
Since
Lens Scripting Version 164
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