showing what is placeable or not
This commit is contained in:
@@ -74,12 +74,11 @@ export const ItemTool: React.FC = () => {
|
||||
[0, 0, 0],
|
||||
[draftItem.current.id],
|
||||
);
|
||||
console.log(
|
||||
"placeable",
|
||||
placeable,
|
||||
[gridPosition.current.x, 0, gridPosition.current.z],
|
||||
selectedItem.dimensions,
|
||||
);
|
||||
if (placeable.valid) {
|
||||
cursorRef.current.material.color.set("green");
|
||||
} else {
|
||||
cursorRef.current.material.color.set("red");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +49,10 @@ export class SpatialGrid {
|
||||
const maxZ = z + rotatedD / 2;
|
||||
|
||||
const [minCx, minCz] = this.posToCell(minX, minZ);
|
||||
const [maxCx, maxCz] = this.posToCell(maxX, maxZ);
|
||||
// Use exclusive upper bound: subtract epsilon so exact boundaries don't overlap
|
||||
// This allows adjacent items (touching but not overlapping) to not conflict
|
||||
const epsilon = 1e-6;
|
||||
const [maxCx, maxCz] = this.posToCell(maxX - epsilon, maxZ - epsilon);
|
||||
|
||||
const keys: CellKey[] = [];
|
||||
for (let cx = minCx; cx <= maxCx; cx++) {
|
||||
|
||||
@@ -11,7 +11,6 @@ export function useSpatialQuery() {
|
||||
rotation: [number, number, number],
|
||||
ignoreIds?: string[],
|
||||
) => {
|
||||
console.log("spatialGridManager in useSpatialQuery:", spatialGridManager);
|
||||
return spatialGridManager.canPlaceOnFloor(
|
||||
levelId,
|
||||
position,
|
||||
|
||||
Reference in New Issue
Block a user