Docs: `useXRControllerLocomotion` rapier example is outdated
https://pmndrs.github.io/xr/docs/getting-started/all-hooks#usexrcontrollerlocomotion
rotationInfo: Euler is now rotationVelocityY: number.
Thanks. I'm assuming this will be fixed with the new technical docs rewrite from @taeuscherpferd
Thanks. I'm assuming this will be fixed with the new technical docs rewrite from @taeuscherpferd
I noticed that #425 no longer seems to contain the rapier example.
@taeuscherpferd just to ping you here so we can make sure the rapier example with controller locomotion is not lost :)
I wrote a new Rapier example referencing the Minecraft example:
import type { RapierRigidBody } from '@react-three/rapier'
import type { Vector3 } from 'three'
import { CapsuleCollider, euler, quat, RigidBody } from '@react-three/rapier'
import { useXRControllerLocomotion, XROrigin } from '@react-three/xr'
import { useRef } from 'react'
export const UserMovementWithPhysics = () => {
const userRigidBodyRef = useRef<RapierRigidBody>(null)
useXRControllerLocomotion((velocity: Vector3, rotationVelocityY: number) => {
if (!userRigidBodyRef.current)
return
userRigidBodyRef.current.setLinvel({ x: velocity.x, y: 0, z: velocity.z }, true)
userRigidBodyRef.current.setRotation(quat(userRigidBodyRef.current.rotation()).multiply(quat().setFromEuler(euler().set(0, rotationVelocityY, 0, 'YXZ'))), true)
})
return (
<RigidBody
canSleep={false}
colliders={false}
enabledRotations={[false, false, false]}
position={[0, 2, 0]}
ref={userRigidBodyRef}
type="dynamic"
>
<CapsuleCollider args={[0.3, 0.5]} />
<XROrigin position={[0, -1, 0]} />
</RigidBody>
)
}
@taeuscherpferd just to ping you here so we can make sure the rapier example with controller locomotion is not lost :)
I'll be sure to add it to my priority stack of TODOs 👍