Transform
Updated
Position, rotation and scale of the entity, with optional editor-only per-axis locks.
- Type
comp-transform- Script class
TransformComponent- Per entity
- One
- Version
- 1.1.1
- Enable
- Always on
Read about it in Common components: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
position.x |
||
position.y |
||
position.z |
||
rotation.x |
||
rotation.y |
||
rotation.z |
||
scale.x |
||
scale.y |
||
scale.z |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
Transform::position-changeTransform::rotation-changeTransform::scale-changeTransform::change
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Hear a Transform moveA script adds a filtered Signal Emitter to a crate, then moves it twice: setPosition reports a Transform event, a direct write to position does not.
Read the script log: one line for the setPosition call, none for the direct write.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(TransformComponent); if (component) log(component.props);}