Transform
Every Entity uses a Transform to be moved, rotated and scaled.
Transform
Used to represent an entity in space, it holds position, orientation and scale.
Transform.position: vec3
Transform.orientation: quat
Transform.scale: float
setPosition(entity, position)
Set the position of an entity in its local space (move this entity relative to its parent when there is a parent).
Arguments
entity: Entity, a pointer to an entity in the world.
position: vec3
getPosition(entity)
Get the position of an entity in its local space.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
vec3
setPositionGlobal(entity, position)
Set the position of an entity in global space (disregards the parent and move this entity anywhere in the world).
Arguments
entity: Entity, a pointer to an entity in the world.
position: vec3
getPositionGlobal(entity)
Get the position of an entity in its global space.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
vec3
setOrientation(entity, orientation)
Set the orientation of an entity in its local space (rotate this entity relative to its parent when there is a parent).
Arguments
entity: Entity, a pointer to an entity in the world.
orientation: quat
getOrientation(entity)
Get the orientation of an entity in its local space.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
quat
setOrientationGlobal(entity, orientation)
Set the position of an entity in global space (disregards the parent and move this entity anywhere in the world).
Arguments
entity: Entity, a pointer to an entity in the world.
orientation: quat
getOrientationGlobal(entity)
Get the orientation of an entity in its global space.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
quat
setScale(entity, scale)
Set the scale of an entity in local space (scale this entity relative to its parent when there is a parent).
Arguments
entity: Entity, a pointer to an entity in the world.
scale: float, a single number representing the uniform scale of the entity.
getScale(entity)
Get the scale of an entity in local space.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
vec3
setScaleGlobal(entity, scale)
Set the scale of an entity in global space (disregards the parent and scale this entity in world space).
Arguments
entity: Entity, a pointer to an entity in the world.
scale: float, a single number representing the uniform scale of the entity.
getScaleGlobal(entity)
Get the scale of an entity in global space.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
vec3
setTransform(entity, transform)
Set a transform for an entity in local space.
Arguments
entity: Entity, a pointer to an entity in the world.
transform: Transform
getTransform(entity)
Get the local transform of an entity. This is a copy of the transform held by the entity, changing this will not have any direct effect on the entity itself.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
Transform
setTransformGlobal(entity, transform)
Set a transform for entity in global space.
Arguments
entity: Entity, a pointer to an entity in the world.
transform: Transform
getTransformGlobal(entity)
Get the global transform of an entity. This is a copy of the transform held by the entity, changing this won't have any effect on the entity itself.
Arguments
entity: Entity, a pointer to an entity in the world.
Return
Transform
setProperty(entity, name, value)
Set a custom property of an entity by name, value
Arguments
entity: Entity, a pointer to an entity in the world.
name: string
value: number
getProperty(entity, name)
Get a custom property of an entity by name
Arguments
entity: Entity, a pointer to an entity in the world.
name: string
Return
Entity , a pointer to an entity in the world, nil if the entity was not found.
getProperties(entity)
Get a table of custom properties that are set on this entity
Arguments
entity: Entity, a pointer to an entity in the world.
Return
table
lookAtOrientation(forwardVec, upVec)
Create a quaternion rotation from two vec3 (vectors must be normalized).
Arguments
forwardVec:
upVec:
Return
quat