1. @threlte/rapier
  2. useFixedJoint

@threlte/rapier

useFixedJoint

Use this hook to initialize a FixedImpulseJoint.

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

	const { joint, rigidBodyA, rigidBodyB } = useFixedJoint({ x: 1 }, {}, {x: -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<FixedImpulseJoint>
	rigidBodyA: Writable<RAPIER.RigidBody>
	rigidBodyB: Writable<RAPIER.RigidBody>
} = useFixedJoint(
	anchorA,  // Position
  frameA,   // Rotation
  anchorB,  // Position
  frameB    // Rotation
)