decal bug fix

This commit is contained in:
2025-08-28 16:01:16 +05:30
parent 8ff609b85c
commit 92b1ba6197

View File

@@ -15,7 +15,7 @@ import { getUserData } from '../../../../functions/getUserData';
function DecalCreator() {
const { wallStore, floorStore } = useSceneContext();
const { addDecal: addDecalOnWall, getWallById } = wallStore();
const { addDecal : addDecalOnFloor, getFloorById } = floorStore();
const { addDecal: addDecalOnFloor, getFloorById } = floorStore();
const { droppedDecal } = useDroppedDecal();
const { activeModule } = useModuleStore();
const { userId, organization } = getUserData();
@@ -36,6 +36,7 @@ function DecalCreator() {
const intersects = raycaster.intersectObjects(scene.children, true);
const wallIntersect = intersects.find(i => i.object.userData && i.object.userData.wallUuid);
const floorIntersect = intersects.find(i => i.object.userData && i.object.userData.floorUuid);
console.log('wallIntersect: ', wallIntersect);
if (wallIntersect) {
const wall = getWallById(wallIntersect.object.userData.wallUuid);
@@ -51,7 +52,7 @@ function DecalCreator() {
type: 'Wall',
wallUuid: wallIntersect.object.userData.wallUuid,
},
decalPosition: [point.x, point.y, wall.wallThickness / 2 + 0.001],
decalPosition: [point.x, point.y, (wall.wallThickness / 2 + 0.001) * (wallIntersect.normal?.z || 1)],
decalRotation: 0,
decalOpacity: 1,
decalScale: 1,