Physics Spring Joint
Updated
Soft springy link between bodies.
- Type
comp-physics-spring-joint- Script class
PhysicsSpringJointComponent- Per entity
- One
- Version
- 2.0.0
Read about it in Joints: 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 |
|---|---|---|
damping |
0 ≤ x ≤ 10000 |
|
restLength |
0 ≤ x ≤ 10000 |
|
stiffness |
0 ≤ x ≤ 100000 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Stiffen a wobbly bridgeA bridge of planks linked in a chain by a Spring Joint, held at both ends: it sags and sways under a ball, and Pull the lever stiffens the springs so it holds firm, with the same rest lengths.
Watch the bridge sag under the ball, then press Pull the lever to make it firm, and again to let it sway. 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(PhysicsSpringJointComponent); if (component) log(component.props);}