1. @threlte/rapier
  2. useRevoluteJoint

@threlte/rapier

useRevoluteJoint

Use this hook to initialize a RevoluteImpulseJoint.

<script>
	import { useRevoluteJoint, RigidBody, Collider } from '@threlte/rapier'

	const { joint, rigidBodyA, rigidBodyB } = useRevoluteJoint({ x: 1 }, {}, { y: 1 })
</script>

<RigidBody bind:rigidBody={$rigidBodyA}>
	<Collider shape="cuboid" args={[1, 1, 1]} />
</RigidBody>

<RigidBody bind:rigidBody={$rigidBodyB}>
	<Collider shape="cuboid" args={[1, 1, 1]} />
</RigidBody>

Import

Source

Github View Source Code

Package

NPM View Package

Signature

const {
	joint: Writable<RevoluteImpulseJoint>
	rigidBodyA: Writable<RAPIER.RigidBody>
	rigidBodyB: Writable<RAPIER.RigidBody>
} = useRevoluteJoint(
	anchorA,  // Position
  anchorB,  // Position
  axis,     // Rotation
  limits    // [min, max] | undefined
)