Steering Flee
Updated
Run away from a target when it gets close.
- Type
comp-steering-flee- Script class
SteeringFleeComponent- Per entity
- Several
- Version
- 1.0.0
Read about it in Steering: 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 |
|---|---|---|
panicDistance |
0 ≤ x ≤ 1000 |
|
weight |
0 ≤ x ≤ 10 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Flee when the wolf howlsSix wandering, flocking sheep each get a Steering Flee from a script, disabled until the wolf howls: then fleeing outweighs the other behaviours and the flock scatters.
Press Howl: the sheep run from the amber wolf until they are 12 m away. Press Wolf leaves and they drift back together. 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(SteeringFleeComponent); if (component) log(component.props);}