Methods
attachComponent(componentName, value)
Attempt to add a component to the entity. The method will fail if the entity already own the specified component.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
value |
object | Component value |
detachComponent(componentName)
Attempt to remove a component from the entity. This method will fail if the entity doesn't own the specified component.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
focusOn(viewport) → {Promise}
Animate camera traveling from of a viewport point of view to the entity.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
viewport |
SDK3DVerse_Viewport | Viewport to animate |
|
options.startPosition |
vec3 |
<optional> |
initial position of camera, defaults to current position |
options.startOrientation |
quaternion |
<optional> |
initial orientation of camera, defaults to current orientation |
options.speedFactor |
number |
<optional> |
Default 4, travel animation speed |
options.distanceShift |
number |
<optional> |
Default 0, increase travel distance to stop before the focused entity |
Returns:
A Promise that resolves when the travel is over.
- Type
- Promise
getAncestors() → {Array.<SDK3DVerse_Entity>}
Retrieve all entity's parents, starting from his parent to the root node.
Returns:
Entity's ancestors
- Type
- Array.<SDK3DVerse_Entity>
getChildOverriders() → {Array.<SDK3DVerse_Entity>}
Return a list of overrider, which are overriding the entity children. Only functional on linkers, or external entities.
Returns:
Overrider entities.
- Type
- Array.<SDK3DVerse_Entity>
getComponent(componentName) → {object}
Get specified component value.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
Returns:
Asked component state.
- Type
- object
getComponentList() → {Array.<string>}
Get a list of all component's name attached to the entity
Returns:
Component names
- Type
- Array.<string>
getComponents() → {Map.<object>}
Get all attached components values.
Returns:
Components value.
- Type
- Map.<object>
getEUID() → {string}
Get entity UUID. This identifier can be shared by multiple instances of the same entity, across linked scenes.
Returns:
uuid
- Type
- string
getGlobalAABB() → {object}
Compute the entity global Axis Aligned Bounding Box. If the entity doesn't have a bounding box, use a default local bounding of box [-1, -1, -1] [1, 1, 1]
Returns:
aabb - Global AABB
- Type
- object
getGlobalMatrix() → {mat4}
Get the entity global matrix.
Returns:
Global matrix
- Type
- mat4
getGlobalTransform() → {transform}
Get the entity global transform.
Returns:
Global transform
- Type
- transform
getID() → {string}
Get Entity unique runtime identifier. This identifier is the unique way to target a specific entity instance.
Returns:
rtid
- Type
- string
getLocalMatrix() → {mat4}
Get the entity local matrix.
Returns:
Local matrix
- Type
- mat4
getName() → {string}
Get the entity name.
Returns:
Entity name
- Type
- string
getParent() → {SDK3DVerse_Entity}
Get the entity's parent.
Returns:
Entity's parent
- Type
- SDK3DVerse_Entity
hasChildren() → {bool}
Check if the entity has children.
Returns:
Has children state
- Type
- bool
hasChildrenOverridden() → {bool}
Return true if the entity (or any child) contains an overrider. Only functional on linkers, or external entities.
Returns:
Has children overridden state.
- Type
- bool
hasParent() → {bool}
Check if the entity has a parent.
Returns:
Has parent state
- Type
- bool
isAttached(componentName) → {bool}
Return true if the entity own the specified component.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
Returns:
Asked component state.
- Type
- bool
isComponentMarkedAsDetached(componentClassName) → {bool}
Return true if the requested component is marked as detached.
Parameters:
Name | Type | Description |
---|---|---|
componentClassName |
string |
Returns:
Marked as detached state.
- Type
- bool
isComponentOverridden(componentName) → {bool}
Return true if the specified component is overridden.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
Returns:
Asked component overridden state.
- Type
- bool
isExternal() → {bool}
Return true if the entity belongs to another scene.
Returns:
External state
- Type
- bool
isLinker() → {bool}
Return true if the entity is a linker.
Returns:
Linker state.
- Type
- bool
isMarkedAsDeleted(recursive) → {bool}
Return true if the entity is marked as deleted in his linker lineage.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
recursive |
bool |
true
|
Default to true, check if any parent is marked as deleted |
Returns:
Marked as deleted state.
- Type
- bool
isOverridden() → {bool}
Return true if the entity has at least one component overridden by another entity.
Returns:
Overridden state.
- Type
- bool
isOverrider() → {bool}
Return true if the entity is an overrider.
Returns:
Overrider state.
- Type
- bool
isRuntime() → {bool}
Return true if the entity is a runtime entity.
Returns:
Runtime state
- Type
- bool
isSame() → {bool}
Return true if the entity is the same instance of the specified entity.
Returns:
Entity parity.
- Type
- bool
isSelected() → {bool}
Return true if the entity is currently selected by the user. This state can be changed by calling engineAPI.selectEntity() method.
Returns:
Selected state
- Type
- bool
isVisible() → {bool}
Get visibility state. This state can be changed by calling engineAPI.setEntityVisibility method.
Returns:
Visibility state
- Type
- bool
lookAt(target)
Set the global orientation to make the entity look at the target point.
Parameters:
Name | Type | Description |
---|---|---|
target |
Array.<number> | Point to look at in global space |
setComponent(componentName, value)
Attempt to update the specified component value. The method will fail if the entity doesn't own the specified component.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
value |
object | Component value |
setGlobalTransform(globalTransform)
Set the entity global transform.
Parameters:
Name | Type | Description |
---|---|---|
globalTransform |
transform | Global transform |
setOrAttachComponent(componentName, value)
Update the specified component value, or attach it if the entity doesn't own the specified component.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
string | Component name |
value |
object | Component value |
setOrientation(globalOrientation)
Set the entity global orientation.
Parameters:
Name | Type | Description |
---|---|---|
globalOrientation |
Array.<number> | Global orientation expressed as quaternion |
setPosition(globalPosition)
Set the entity global position.
Parameters:
Name | Type | Description |
---|---|---|
globalPosition |
Array.<number> | Global position |
setScale(globalScale)
Set the entity global scale.
Parameters:
Name | Type | Description |
---|---|---|
globalScale |
Array.<number> | Global scale |