fixed player controller fps problem
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { observer } from "mobx-react-lite";
|
||||
import type { ObjectType, RuntimeGameObjectInstance } from "../types";
|
||||
import { ObjectViewInternal, type ObjectViewInternalHandle } from "./ObjectViewInternal";
|
||||
import { useEffect, useMemo, useRef } from "react";
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
||||
import { Euler, Quaternion, Vector3 } from "three";
|
||||
import { useFrame, useThree } from "@react-three/fiber";
|
||||
import { useKeyboardControls } from "@react-three/drei";
|
||||
@@ -48,7 +48,8 @@ export const PlayerObjectView = observer(function ({ object, objectType }: Playe
|
||||
};
|
||||
}, [object.cache.boundingBox]);
|
||||
|
||||
const yawRef = useRef(object.rotation[1]);
|
||||
const yawRef = useRef(0);
|
||||
useLayoutEffect(() => { yawRef.current = object.rotation[1]; }, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
const pitchRef = useRef(0);
|
||||
const mouseRef = useRef({ x: 0, y: 0 });
|
||||
const jumpPressedRef = useRef(false);
|
||||
|
||||
Reference in New Issue
Block a user