Follow Target
Updated
Follows an entity ID or name with a movement deadzone.
- Type
comp-follow-target- Script class
FollowTargetComponent- Per entity
- One
- Version
- 3.0.0
Read about it in Follow target: 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 |
|---|---|---|
angle |
0 ≤ x ≤ 3. |
|
offset.x |
||
offset.y |
||
offset.z |
||
position |
0 ≤ x |
|
rotation |
||
rotation |
||
rotation |
||
smoothTime |
0 ≤ x |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Show a "catching up" indicatorA help panel follows the camera with a Follow Target; a script shows a green dot on it only while isFollowing says it is gliding to a new place.
Drag to orbit the camera beyond the panel’s tolerance: the green dot shows while the panel catches up. Scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(FollowTargetComponent); if (component) log(component.props);}