Skip to content

Latest commit

 

History

History
105 lines (49 loc) · 2.01 KB

File metadata and controls

105 lines (49 loc) · 2.01 KB

Home > server > Entity > setParent

Entity.setParent() method

Sets the parent of the entity and resets this entity's position and rotation.

Signature:

setParent(parent: Entity | undefined, parentNodeName?: string, position?: Vector3Like, rotation?: QuaternionLike): void;

Parameters

Parameter

Type

Description

parent

Entity | undefined

The parent entity to set, or undefined to remove from an existing parent.

parentNodeName

string

(Optional) The name of the parent's node (if parent is a model entity) this entity will attach to.

position

Vector3Like

(Optional) The position to set for the entity. If parent is provided, this is relative to the parent's attachment point.

rotation

QuaternionLike

(Optional) The rotation to set for the entity. If parent is provided, this is relative to the parent's rotation.

**Returns:**

void

Remarks

When setting the parent, all forces, torques and velocities of this entity are reset. Additionally, this entity's type will be set to KINEMATIC_VELOCITY if it is not already. All colliders of this entity will be disabled when parent is not undefined. If the provided parent is undefined, this entity will be removed from its parent and all colliders will be re-enabled. When setting an undefined parent to remove this entity from its parent, this entity's type will be set to the last type it was set to before being a child.