LookAtComponent
ClassOrients a SceneObject towards a target SceneObject.
- Available on all platforms
Index
Properties
Methods
Example
// Switches through LookAt targets in a list on each tap
//@input Component.LookAtComponent lookAt
//@input SceneObject[] targets
var targetIndex = 0;
script.createEvent("TapEvent").bind(function(eventData)
{
if(script.targets.length > 0)
{
targetIndex = (targetIndex + 1) % script.targets.length;
script.lookAt.target = script.targets[targetIndex];
}
});
// Set aimVectors to [-Z Aim, Y Up]
// (Useful for aiming the camera since it faces towards -Z)
//@input Component.LookAtComponent lookAt
script.lookAt.aimVectors = LookAtComponent.AimVectors.NegativeZAimYUp;
Extends
Properties
aimVectors
aimVectors:
AimVectors
The "aim" and "up" vectors used when determining rotation.
LookAtComponent will try to point the Aim axis of the SceneObject towards the target,
while keeping the Up axis of the SceneObject pointing towards worldUpVector.
Default Value
LookAtComponent.AimVectors.XAimYUp
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
lookAtMode
lookAtMode:
LookAtMode
Controls the method of rotation being used.
Default Value
LookAtComponent.LookAtMode.LookAtPoint
offsetRotation
offsetRotation:
quat
Adds an additional rotation offset.
Default Value
(1, 0, 0, 0)
sceneObject
readonlysceneObject:SceneObject
The SceneObject this component is on.
Inherited from
target
target:
SceneObject
The SceneObject this LookAtComponent targets.
Default Value
null
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
worldUpVector
worldUpVector:
WorldUpVector
The vector to be considered the "up" vector when determining rotation.
Default Value
LookAtComponent.WorldUpVector.SceneY
Methods
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<LookAtComponent>
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<LookAtComponent>
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
Inherited from
Nested types
Enumerations
| Enumeration | Description |
|---|---|
| AimVectors | The "aim" and "up" vectors used with LookAtComponent when determining rotation. LookAtComponent will try to point the Aim axis of the SceneObject towards the target, while keeping the Up axis of the SceneObject pointing towards worldUpVector. |
| LookAtMode | Modes used in LookAtComponent.lookAtMode to determine the rotation method being used. |
| WorldUpVector | Used with LookAtComponent to set the "up" vector when determining rotation. |