Skip to main content

world

Description

This library includes properties and functions related to the World.

Properties

PropertyTypeDescription
allEntitiesSetSet of all scene entities.

Functions

createEntity

Create a new entity.

world.createEntity() // -> eid

deleteEntity

Delete an existing entity.

world.deleteEntity(eid) // -> void

getChildren

Get children of an entity.

world.getChildren(eid) // -> Generator<Eid>

getParent

Get the parent of an entity.

world.getParent(eid) // -> eid

setParent

Set the parent of an entity.

world.setParent(eid, parent: eid) // -> void

getWorldTransform

Get the world transform of an entity. Copies the worldTransform of the target into the second parameter.

world.getWorldTransform(eid, transform: Mat4) // -> void

setTransform

Set transform of an entity.

world.setTransform(eid, transform: Mat4) // -> void

setPosition

Set position of an entity.

world.setPosition(eid, x: number, y: number, z: number) // -> void

setQuaternion

Set rotation of an entity.

world.setQuaternion(eid, x: number, y: number, z: number, w: number) // -> void

setScale

Set scale of an entity.

world.setScale(eid, x: number, y: number, z: number) // -> void

normalizeQuaternion

Normalizes an entity's quaternion.

world.normalizeQuaternion(eid) // -> void

getInstanceChild

Get all sub-entities of a runtime instantiated prefab instance using the Eid.

world.getInstanceChild(prefabInstance: Eid, parent: Eid) // -> void

raycast

Perform a Raycast from a position and direction.

world.raycast(origin: Vec3, direction: Vec3, near: number = 0, far: number = Infinity) // -> IntersectionResult[]

raycastFrom

Perform a Raycast from an entity's position and forward direction.

world.raycastFrom(eid: Eid, near: number = 0, far: number = Infinity) // -> IntersectionResult[]

IntersectionResult

PropertyTypeDescription
eid?EidThe eid of the object that was hit.
pointVec3The location in World Space where the intersection occurred.
distancenumberThe distance between the starting location and the hit location.
threeDataIntersectionThe three.js intersection data.