Skip to content

Commit

Permalink
Merge pull request #357 from taeuscherpferd/Fixing-minecraft-example-…
Browse files Browse the repository at this point in the history
…after-hook-changes

Fixing minecraft example after hook changes
  • Loading branch information
bbohlender authored Sep 29, 2024
2 parents 987b540 + 654a2b6 commit e68896b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions examples/minecraft/src/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export function Player({ lerp = THREE.MathUtils.lerp }) {
backward,
left,
right,
rotationVelocity,
rotationYVelocity,
velocity,
newVelocity,
}: {
forward: boolean
backward: boolean
left: boolean
right: boolean
rotationVelocity: number
rotationYVelocity: number
velocity?: Vector3Object
newVelocity?: THREE.Vector3
}) => {
Expand All @@ -59,7 +59,7 @@ export function Player({ lerp = THREE.MathUtils.lerp }) {
//apply rotation
const { x, y, z, w } = rigidBodyRef.current.rotation()
quaternionHelper.set(x, y, z, w)
quaternionHelper.multiply(quaternionHelper2.setFromEuler(eulerHelper.set(0, rotationVelocity, 0, 'YXZ')))
quaternionHelper.multiply(quaternionHelper2.setFromEuler(eulerHelper.set(0, rotationYVelocity, 0, 'YXZ')))
rigidBodyRef.current?.setRotation(quaternionHelper, true)

if (newVelocity) {
Expand Down Expand Up @@ -128,7 +128,7 @@ export function Player({ lerp = THREE.MathUtils.lerp }) {
backward,
left,
right,
rotationVelocity: 0,
rotationYVelocity: 0,
velocity,
})

Expand Down
6 changes: 3 additions & 3 deletions examples/minecraft/src/VRPlayerControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ export function VRPlayerControl({
backward: boolean
left: boolean
right: boolean
rotationVelocity: number
rotationYVelocity: number
velocity?: Vector3Object
newVelocity?: THREE.Vector3
}) => void
}) {
const controllerRight = useXRInputSourceState('controller', 'right')

const physicsMove = (velocity: THREE.Vector3, rotationVelocity: number) => {
const physicsMove = (velocity: THREE.Vector3, rotationYVelocity: number) => {
playerMove({
forward: false,
backward: false,
left: false,
right: false,
rotationVelocity,
rotationYVelocity,
velocity: undefined,
newVelocity: velocity,
})
Expand Down

0 comments on commit e68896b

Please sign in to comment.