¶
luxe
API (2025.1.2
)¶
luxe: system/transform.modifier
module¶
Data¶
import "luxe: system/transform.modifier" for Data
no docs found
var pos : Double3 = [0, 0, 0]
var rotation : Float3 = [0, 0, 0]
var scale : Float3 = [1, 1, 1]
var link : Link = null
System¶
import "luxe: system/transform.modifier" for System
no docs found
- new(world:
World
)
World
)
¶System
no docs found
Transform¶
import "luxe: system/transform.modifier" for Transform
A transform modifier defines where a entity is. That includes position, rotation and scale. A
Transform
can also be linked to anotherTransform
, in which case its values are relative to their link target.While not all entities need to be "somewhere" locally, a lot of them do, which is when this modifier is used. Other modifiers on the same entity aren't required to read and react to the
Transform
, but most do, allowing you to use this to move things (like Sprites, Meshes, Physics shapes, etc...).
- id
- create(entity:
Entity
, x:Num
, y:Num
) - create(entity:
Entity
, x:Num
, y:Num
, z:Num
) - create(entity:
Entity
) - destroy(entity:
Entity
) - has(entity:
Entity
) - get_link(entity:
Entity
) - get_linked(entity:
Entity
) - link(entity:
Entity
, target_entity:Entity
, reset_local:Bool
) - link(entity:
Entity
, target_entity:Entity
) - unlink(entity:
Entity
, reset_local:Bool
) - unlink(entity:
Entity
) - look_at_and_move(entity:
Entity
, pos:Vec
, target:Vec
, up:Vec
, invert:Bool
) - look_at_and_move(entity:
Entity
, pos:Vec
, target:Vec
, up:Vec
) - look_at_and_move(entity:
Entity
, pos:Vec
, target:Vec
) - look_at(entity:
Entity
, target:Vec
, up:Vec
, invert:Bool
) - look_at(entity:
Entity
, target:Vec
, up:Vec
) - look_at(entity:
Entity
, target:Vec
) - set_snap(entity:
Entity
, x:Num
, y:Num
, z:Num
) - set_snap(entity:
Entity
, x:Num
, y:Num
) - set_pos(entity:
Entity
, x:Num
, y:Num
, z:Num
) - set_pos(entity:
Entity
, x:Num
, y:Num
) - set_pos_world(entity:
Entity
, x:Num
, y:Num
, z:Num
) - set_pos_world(entity:
Entity
, x:Num
, y:Num
) - set_pos_x(entity:
Entity
, x:Num
) - set_pos_y(entity:
Entity
, y:Num
) - set_pos_z(entity:
Entity
, z:Num
) - set_pos_x_world(entity:
Entity
, x:Num
) - set_pos_y_world(entity:
Entity
, y:Num
) - set_pos_z_world(entity:
Entity
, z:Num
) - set_scale(entity:
Entity
, x:Num
, y:Num
) - set_scale(entity:
Entity
, x:Num
, y:Num
, z:Num
) - set_rotation_slerp_angle_axis(entity:
Entity
, axis:Vec
, from:Num
, to:Num
, t:Num
) - set_rotation_slerp_angle_axis_world(entity:
Entity
, axis:Vec
, from:Num
, to:Num
, t:Num
) - set_rotation_slerp(entity:
Entity
, from:Vec
, to:Vec
, t:Num
) - set_rotation_slerp_world(entity:
Entity
, from:Vec
, to:Vec
, t:Num
) - set_rotation(entity:
Entity
, x:Num
, y:Num
, z:Num
, w:Num
) - set_rotation_world(entity:
Entity
, x:Num
, y:Num
, z:Num
, w:Num
) - set_angle_axis(entity:
Entity
, degrees:Any
, x:Num
, y:Num
, z:Num
) - set_angle_axis_world(entity:
Entity
, degrees:Any
, x:Num
, y:Num
, z:Num
) - set_euler(entity:
Entity
, x:Num
, y:Num
, z:Num
) - set_euler_world(entity:
Entity
, x:Num
, y:Num
, z:Num
) - set_euler_x(entity:
Entity
, x:Num
) - set_euler_y(entity:
Entity
, y:Num
) - set_euler_z(entity:
Entity
, z:Num
) - set_euler_x_world(entity:
Entity
, x:Num
) - set_euler_y_world(entity:
Entity
, y:Num
) - set_euler_z_world(entity:
Entity
, z:Num
) - rotate_angle_axis_slerp(entity:
Entity
, axis:Vec
, angle_amount:Num
) - rotate_angle_axis_slerp_world(entity:
Entity
, axis:Vec
, angle_amount:Num
) - rotate_around_world(entity:
Entity
, x:Num
, y:Num
, z:Num
, axis_x:Num
, axis_y:Num
, axis_z:Num
, degrees:Num
) - rotate_around(entity:
Entity
, x:Num
, y:Num
, z:Num
, axis_x:Num
, axis_y:Num
, axis_z:Num
, degrees:Num
) - rotate_angle_axis(entity:
Entity
, degrees:Any
, x:Num
, y:Num
, z:Num
) - rotate_angle_axis_world(entity:
Entity
, degrees:Any
, x:Num
, y:Num
, z:Num
) - rotate_euler(entity:
Entity
, x:Num
, y:Num
, z:Num
) - rotate_euler_world(entity:
Entity
, x:Num
, y:Num
, z:Num
) - translate(entity:
Entity
, x:Num
, y:Num
, z:Num
) - translate(entity:
Entity
, x:Num
, y:Num
) - get_pos(entity:
Entity
) - get_pos_x(entity:
Entity
) - get_pos_y(entity:
Entity
) - get_pos_z(entity:
Entity
) - get_pos_world(entity:
Entity
) - get_pos_world_unsnapped(entity:
Entity
) - get_pos_x_world(entity:
Entity
) - get_pos_y_world(entity:
Entity
) - get_pos_z_world(entity:
Entity
) - rotate2D(entity:
Entity
, degrees:Num
) - set_angle2D(entity:
Entity
, degrees:Num
) - set_angle2D_world(entity:
Entity
, degrees:Num
) - get_angle2D(entity:
Entity
) - get_angle2D_world(entity:
Entity
) - set_depth2D(entity:
Entity
, depth:Num
) - get_depth2D(entity:
Entity
) - set_depth2D_world(entity:
Entity
, depth:Num
) - get_depth2D_world(entity:
Entity
) - get_world_matrix(entity:
Entity
, into_matrix:Floats
) - get_rotation(entity:
Entity
) - get_rotation_world(entity:
Entity
) - get_rotation_matrix(entity:
Entity
, into_matrix:Floats
) - get_euler(entity:
Entity
) - get_euler_x(entity:
Entity
) - get_euler_y(entity:
Entity
) - get_euler_z(entity:
Entity
) - get_euler_world(entity:
Entity
) - get_euler_x_world(entity:
Entity
) - get_euler_y_world(entity:
Entity
) - get_euler_z_world(entity:
Entity
) - get_scale(entity:
Entity
) - get_scale_x(entity:
Entity
) - get_scale_y(entity:
Entity
) - get_scale_z(entity:
Entity
) - get_scale_world(entity:
Entity
) - get_scale_x_world(entity:
Entity
) - get_scale_y_world(entity:
Entity
) - get_scale_z_world(entity:
Entity
) - get_right(entity:
Entity
) - get_forward(entity:
Entity
) - get_up(entity:
Entity
) - sync(entity:
Entity
) - sync_block(entity:
Entity
, mask:TransformApplyMask
) - sync_world(world:
World
) - transform_by(entity:
Entity
, other:Entity
) - scale_by(entity:
Entity
, scale:Float3
, origin:Float3
) - rotate_euler_by(entity:
Entity
, euler:Float3
, origin:Float3
) - local_vector_to_world(entity:
Entity
, x:Num
, y:Num
, z:Num
) - world_vector_to_local(entity:
Entity
, x:Num
, y:Num
, z:Num
) - local_dir_to_world(entity:
Entity
, x:Num
, y:Num
, z:Num
) - world_dir_to_local(entity:
Entity
, x:Num
, y:Num
, z:Num
) - local_point_to_world(entity:
Entity
, x:Num
, y:Num
, z:Num
) - local_point_to_world(entity:
Entity
, x:Num
, y:Num
, z:Num
, scaled:Bool
) - world_point_to_local(entity:
Entity
, x:Num
, y:Num
, z:Num
) - world_point_to_local(entity:
Entity
, x:Num
, y:Num
, z:Num
, scaled:Bool
) - listen_all(world:
World
, fn:Fn
) - unlisten_all(world:
World
, handle:Handle
) - listen(entity:
Entity
, fn:Fn
) - unlisten(entity:
Entity
, handle:Handle
)
unknown
no docs found
Entity
, x: Num
, y: Num
)
¶None
Attach a
Transform
modifier to an entity with the givenx
andy
position (with a z of 0)
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Attach a
Transform
modifier to an entity with the givenx
,y
andz
position
Entity
)
¶None
Attach a
Transform
modifier to an entity.
Entity
)
¶None
Detatch a
Transform
modifier from an entity.
Entity
)
¶Bool
get whether an entity has an attached
Transform
.
Entity
)
¶Entity
Get what entity this entity is linked to. So what entity the position/rotation/scale of this transform are relative to. Linked to entity always has a
Transform
of its own. In caseTransform
isn't linked to anything, returnsnull
and transformations are global.
Entity
)
¶List
Get what entities are linked to this entity (opposite relationship as
get_link
). Transformation values of linked entities are relative to this entity.
Entity
, target_entity: Entity
, reset_local: Bool
)
¶None
Link one
Transform
to another. TheTransform
values will now be be relative to the link target, meaning the link targetTransform
position, rotation and scale all apply to the local position, rotation, scale of thisTransform
. When using non-uniform scales somewhere in your transform link hierarchy you can get transform deformations that would not be possible with just a single transform.In other environments, this transform link is often part of the object hierarchy, but here it's specific to transforms and other hierarchies aren't bound to follow the same links.
Entity
, target_entity: Entity
)
¶None
Link one
Transform
to another. TheTransform
values will now be be relative to the link target, meaning the link targetTransform
position, rotation and scale all apply to the local position, rotation, scale of thisTransform
. When using non-uniform scales somewhere in your transform link hierarchy you can get transform deformations that would not be possible with just a single transform.In other environments, this transform link is often part of the object hierarchy, but here it's specific to transforms and other hierarchies aren't bound to follow the same links.
Entity
, reset_local: Bool
)
¶None
Unlink a
Transform
. Local position will be kept (unless reset), so if your parent isnt at the origin, expect the transform to move, or save and reapply the world position.
Entity
)
¶None
Unlink a
Transform
. Local position will be kept, so if your parent isnt at the origin, expect the transform to move, or save and reapply the world position.//get the current jar position var pos = Transform.get_pos_world(_jar) //unlink the jar from the player first Transform.unlink(_jar) //set the position for the jar, which now refers //to world space since the jar has no parent //this makes the jar stay in the same place Transform.set_pos(_jar, pos.x, pos.y, pos.z)
Entity
, pos: Vec
, target: Vec
, up: Vec
, invert: Bool
)
¶None
Move
Transform
somewhere else, then look towards target position.
Entity
, pos: Vec
, target: Vec
, up: Vec
)
¶None
Move
Transform
somewhere else, then look towards target position.
Entity
, pos: Vec
, target: Vec
)
¶None
Move
Transform
somewhere else, then look towards target position.
Entity
, target: Vec
, up: Vec
, invert: Bool
)
¶None
Rotate
Transform
to look at a position in worldspace, rotated around that new view axis so theTransform
'up' aligns with theup
input as closely as possible.
Entity
, target: Vec
, up: Vec
)
¶None
Rotate
Transform
to look at a position in worldspace, rotated around that new view axis so theTransform
'up' aligns with theup
input as closely as possible.
Entity
, target: Vec
)
¶None
Rotate
Transform
to look at a position in worldspace.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Set
Transform
position to snap at specific intervals. (midpoints round away from 0)var entity = Entity.create(world) Transform.create(entity) Transform.set_snap(entity, 2, 2, 2) Transform.set_pos(entity, 0.5, 1.5, -3) Log.print(Transform.get_pos(entity)) //[0, 2, -4]
Entity
, x: Num
, y: Num
)
¶None
Set
Transform
position to snap at specific intervals.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Set local position of a
Transform
.
Entity
, x: Num
, y: Num
)
¶None
Set local position of a
Transform
.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Set global position of a
Transform
.
Entity
, x: Num
, y: Num
)
¶None
Set global position of a
Transform
.
Entity
, x: Num
)
¶None
Set
x
component of localTransform
pos.
Entity
, y: Num
)
¶None
Set
y
component of localTransform
pos.
Entity
, z: Num
)
¶None
Set
z
component of localTransform
pos.
Entity
, x: Num
)
¶None
Set
x
component of globalTransform
pos.
Entity
, y: Num
)
¶None
Set
y
component of globalTransform
pos.
Entity
, z: Num
)
¶None
Set
z
component of globalTransform
pos.
Entity
, x: Num
, y: Num
)
¶None
Set x and y scale of a
Transform
, keeping z scale unchanged.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Set local scale of a
Transform
. Setting the scale in a global context isnt available, as link hierarchies with rotations and nonuniform scalings can lead to weird and hard to predict states for that.
Entity
, axis: Vec
, from: Num
, to: Num
, t: Num
)
¶None
no docs found
Entity
, axis: Vec
, from: Num
, to: Num
, t: Num
)
¶None
no docs found
Entity
, from: Vec
, to: Vec
, t: Num
)
¶None
no docs found
Entity
, from: Vec
, to: Vec
, t: Num
)
¶None
no docs found
Entity
, x: Num
, y: Num
, z: Num
, w: Num
)
¶None
Set local rotation in quaternions.
(Quaternions are how rotations are handled by the engine internally, though it can be hard to understand how to manipulate them, so feel free to stick to euler angles using
set_euler(entity, x, y, z)
.)
Entity
, x: Num
, y: Num
, z: Num
, w: Num
)
¶None
Set global rotation in quaternions.
(Quaternions are how rotations are handled by the engine internally, though it can be hard to understand how to manipulate them, so feel free to stick to euler angles using
set_euler_world(entity, x, y, z)
.)
Entity
, degrees: Any
, x: Num
, y: Num
, z: Num
)
¶None
Set local rotation as a rotation around an axis.
Rotation direction is left-handed (counter-clockwise when looking in the direction of the axis.)
Entity
, degrees: Any
, x: Num
, y: Num
, z: Num
)
¶None
Set global rotation as a rotation around an axis.
Rotation direction is left-handed (counter-clockwise when looking in the direction of the axis.)
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Set local rotation as xyz euler angles.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Set global rotation as xyz euler angles.
Entity
, x: Num
)
¶None
no docs found
Entity
, y: Num
)
¶None
no docs found
Entity
, z: Num
)
¶None
no docs found
Entity
, x: Num
)
¶None
no docs found
Entity
, y: Num
)
¶None
no docs found
Entity
, z: Num
)
¶None
no docs found
Entity
, axis: Vec
, angle_amount: Num
)
¶None
no docs found
Entity
, axis: Vec
, angle_amount: Num
)
¶None
no docs found
Entity
, x: Num
, y: Num
, z: Num
, axis_x: Num
, axis_y: Num
, axis_z: Num
, degrees: Num
)
¶None
Rotate around an axis in world space.
Entity
, x: Num
, y: Num
, z: Num
, axis_x: Num
, axis_y: Num
, axis_z: Num
, degrees: Num
)
¶None
Rotate around an axis in local space.
Entity
, degrees: Any
, x: Num
, y: Num
, z: Num
)
¶None
Rotate on the spot around an axis in local coordinates.
Entity
, degrees: Any
, x: Num
, y: Num
, z: Num
)
¶None
Rotate on the spot around an axis in global coordinates.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Rotate by euler angles in local space.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Rotate by euler angles in global space.
Entity
, x: Num
, y: Num
, z: Num
)
¶None
Move
Transform
in local space.
Entity
, x: Num
, y: Num
)
¶None
Move
Transform
in local space.
Entity
)
¶Vec
Get position local space (relative to link
Transform
).
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶unknown
Get position global space.
Entity
)
¶Vec
Get position global space independently of
set_snap
settings.
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
, degrees: Num
)
¶None
Rotate the
Transform
in local space.This technically rotates around the z axis, since thats the only axis we care about in 2d contexts.
Entity
, degrees: Num
)
¶None
Set the 2d angle in local space.
This is technically the same as
set_euler_z
(doesnt touch x or y), since thats the only axis we care about in 2d contexts.
Entity
, degrees: Num
)
¶None
Set the 2d angle in global space.
This is technically the same as
set_euler_z
(doesnt touch x or y), since thats the only axis we care about in 2d contexts.
Entity
)
¶Num
Get the 2d angle in local space.
This is technically the same as
get_euler_z
, since thats the only axis we care about in 2d contexts.
Entity
)
¶Num
Get the 2d angle in global space.
This is technically the same as
get_euler_z_world
, since thats the only axis we care about in 2d contexts.
Entity
, depth: Num
)
¶None
Set the local depth (relative to link
Transform
).This is technically the same as
set_pos_z
.
Entity
)
¶Num
Get the local depth (relative to link
Transform
).This is technically the same as
get_pos_z
.
Entity
, depth: Num
)
¶None
Set the global depth.
This is technically the same as
set_pos_z_world
.
Entity
)
¶Num
Get the global depth.
This is technically the same as
get_pos_z_world
.
Entity
, into_matrix: Floats
)
¶None
Get 4x4 world transform matrix (column major array).
var ent = Entity.create(app.world) Transform.create(ent) Transform.set_pos(ent, 2, 3, 4) var matrix = Floats.new(16) Transform.get_world_matrix(ent, matrix) //matrix is now [1,0,0,0, 0,1,0,0, 0,0,1,0, 2,3,4,1]
Entity
)
¶Quat
Get local quaternion rotation.
(Note that quaternions can be unfamiliar and hard to manipulate, so if you're not familiar with them you might want to use
get_euler
instead)
Entity
)
¶Quat
Get global quaternion rotation.
(Note that quaternions can be unfamiliar and hard to manipulate, so if you're not familiar with them you might want to use
get_euler_world
instead)
Entity
, into_matrix: Floats
)
¶None
Get 4x4 world rotation matrix (column major array).
Entity
)
¶Vec
Get local euler angles.
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Vec
Get global euler angles.
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Vec
Get local scale.
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Vec
Get global scale. Note that through rotations and non-uniform scale in the transform link hierarchy, getting an accurate world scale might be impossible, making this lossy.
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Num
no docs found
Entity
)
¶Vec
Get the "right" direction of the
Transform
. Same direction as the red arrow in the translation gizmo in the editor.
Entity
)
¶Vec
Get the "forward" direction of the
Transform
. Same direction as the green arrow in the translation gizmo in the editor.
Entity
)
¶Vec
Get the "up" direction of the
Transform
. Same direction as the blue arrow in the translation gizmo in the editor.
Entity
)
¶None
Forces a sync of the
Transform
. Will trigger listen functions. This usually shouldn't be needed asTransform
sync automatically when updated.
Entity
, mask: TransformApplyMask
)
¶None
Forces a sync of the
Transform
block data. Will trigger block listener functions. This usually shouldn't be needed asTransform
sync automatically when updated.
World
)
¶None
Forces a sync of all
Transform
in a world. Will trigger listen functions. This usually shouldn't be needed asTransform
sync automatically when updated.
Entity
, other: Entity
)
¶None
Transform the given entity by another entities transform. e.g set world using the other as a parent
Entity
, scale: Float3
, origin: Float3
)
¶None
Transform the given entity scale by the value around the given origin
Entity
, euler: Float3
, origin: Float3
)
¶None
Transform the given entity rotation around the origin, by euler amount (radians)
Entity
, x: Num
, y: Num
, z: Num
)
¶Vec
Convert a vector from local space to world space. (applies scale and rotation, but not translation)
Entity
, x: Num
, y: Num
, z: Num
)
¶Vec
Convert a vector from world space to local space. (applies scale and rotation, but not translation)
Entity
, x: Num
, y: Num
, z: Num
)
¶Vec
Convert a direction from local space to world space. (applies only rotation, not rotation or translation)
Entity
, x: Num
, y: Num
, z: Num
)
¶Vec
Convert a direction from world space to local space. (applies only rotation, not rotation or translation)
Entity
, x: Num
, y: Num
, z: Num
)
¶Vec
Convert a point from local space to world space. (applies translation, rotation and scale)
Entity
, x: Num
, y: Num
, z: Num
, scaled: Bool
)
¶Vec
Convert a point from local space to world space. (applies translation, rotation and optionally, scale)
Entity
, x: Num
, y: Num
, z: Num
)
¶Vec
Convert a point from world space to local space. (applies translation, rotation and scale)
Entity
, x: Num
, y: Num
, z: Num
, scaled: Bool
)
¶Vec
Convert a point from world space to local space. (applies translation, rotation and optionally, scale)
World
, fn: Fn
)
¶Handle
no docs found
World
, handle: Handle
)
¶None
no docs found
Entity
, fn: Fn
)
¶Handle
no docs found
Entity
, handle: Handle
)
¶None
no docs found
TransformApplyMask¶
import "luxe: system/transform.modifier" for TransformApplyMask
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found