Physics Spherical Joint
Updated
Links the bodies in a group at one pivot, free to swing around it like a ball and socket.
- Type
comp-physics-spherical-joint- Script class
PhysicsSphericalJointComponent- 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 |
|---|---|---|
pivot |
||
pivot.x |
- |
|
pivot.y |
- |
|
pivot.z |
- |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Push the pendulumA pendulum hangs from a fixed pivot on a Spherical Joint, a ball and socket; each press of P gives the bob a sideways impulse and it swings, free to turn in any direction about the pivot.
Click the view, then press P to push the bob; press it again mid-swing to add to the swing. 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(PhysicsSphericalJointComponent); if (component) log(component.props);}