mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-22 22:00:59 +00:00
WaterBlock tiling to match T2/Torque, improve CLAUDE.md
This commit is contained in:
parent
bcf4f4a1a5
commit
aeda3ca8d5
940 changed files with 1207 additions and 337 deletions
25
src/components/usePositionTracker.ts
Normal file
25
src/components/usePositionTracker.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { useCallback, useRef } from "react";
|
||||
import { Vector3 } from "three";
|
||||
|
||||
export function usePositionTracker() {
|
||||
const positionRef = useRef<Vector3>(null);
|
||||
|
||||
const hasChanged = useCallback((position: Vector3) => {
|
||||
if (!positionRef.current) {
|
||||
positionRef.current = position.clone();
|
||||
return true;
|
||||
}
|
||||
const isSamePosition =
|
||||
positionRef.current.x === position.x &&
|
||||
positionRef.current.y === position.y &&
|
||||
positionRef.current.z === position.z;
|
||||
|
||||
if (!isSamePosition) {
|
||||
positionRef.current.copy(position);
|
||||
}
|
||||
|
||||
return isSamePosition;
|
||||
}, []);
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue