Skip to content

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.

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

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • Transform::position-change
  • Transform::rotation-change
  • Transform::scale-change
  • Transform::change

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(TransformComponent);
if (component) log(component.props);
}