Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -51,10 +51,13 @@ const WristToggle = forwardRef<THREE.Group, { open: boolean; onToggle: () => voi
|
|||||||
export function XRHudInWorld(props: XRHudInWorldProps) {
|
export function XRHudInWorld(props: XRHudInWorldProps) {
|
||||||
const { camera } = useThree();
|
const { camera } = useThree();
|
||||||
const leftCtrl = useXRInputSourceState('controller', 'left');
|
const leftCtrl = useXRInputSourceState('controller', 'left');
|
||||||
|
const rightCtrl = useXRInputSourceState('controller', 'right');
|
||||||
const [open, setOpen] = useState(true);
|
const [open, setOpen] = useState(true);
|
||||||
const [tab, setTab] = useState<Tab>('scene');
|
const [tab, setTab] = useState<Tab>('scene');
|
||||||
/** When pinned, the panel stays fixed in world space and does NOT follow the head. */
|
/** When pinned, the panel stays fixed in world space and does NOT follow the head. */
|
||||||
const [pinned, setPinned] = useState(true);
|
const [pinned, setPinned] = useState(true);
|
||||||
|
/** While true, the panel is glued to the right controller (drag mode). */
|
||||||
|
const [dragging, setDragging] = useState(false);
|
||||||
/** Forces re-anchor on next frame (used by "trazer" / unpin→pin). */
|
/** Forces re-anchor on next frame (used by "trazer" / unpin→pin). */
|
||||||
const reanchorRequested = useRef(true);
|
const reanchorRequested = useRef(true);
|
||||||
|
|
||||||
@@ -63,6 +66,10 @@ export function XRHudInWorld(props: XRHudInWorldProps) {
|
|||||||
const targetPos = useRef(new THREE.Vector3());
|
const targetPos = useRef(new THREE.Vector3());
|
||||||
const targetQuat = useRef(new THREE.Quaternion());
|
const targetQuat = useRef(new THREE.Quaternion());
|
||||||
const lastABtn = useRef(false);
|
const lastABtn = useRef(false);
|
||||||
|
/** Cached offset from controller to panel at drag start. */
|
||||||
|
const dragOffsetPos = useRef(new THREE.Vector3());
|
||||||
|
const dragOffsetQuat = useRef(new THREE.Quaternion());
|
||||||
|
const dragInitialized = useRef(false);
|
||||||
|
|
||||||
useFrame(() => {
|
useFrame(() => {
|
||||||
// Toggle via left A button (Quest Touch buttons[4])
|
// Toggle via left A button (Quest Touch buttons[4])
|
||||||
|
|||||||
Reference in New Issue
Block a user