Group
Updated
Recenters the group on its children, on demand, without moving them.
- Type
comp-group- Script class
GroupComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Common components: what it does, how to use it from a script, and examples.
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Recenter a group built at run timeA script spawns four bricks under the Pile group, then calls recenter() on its Group component, so the pile spins around the middle of its bricks instead of its old origin.
Watch the bricks turn around their own centre; the log says how many entities recenter() moved. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(GroupComponent); if (component) log(component.props);}