Camera Recoil
Updated
The kick of the player’s own shot or swing, set off by a script.
- Type
comp-camera-recoil- Script class
CameraRecoilEffectComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Camera effects: 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 |
|---|---|---|
amplitude |
||
duration |
||
rotation |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Recoil on every shotHolding the left mouse button fires every 0.12 seconds, and each shot kicks the view through the camera's Camera Recoil effect.
Hold the left mouse button over the view to fire and watch the view climb.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(CameraRecoilEffectComponent); if (component) log(component.props);}