decal bug fix
This commit is contained in:
@@ -15,7 +15,7 @@ import { getUserData } from '../../../../functions/getUserData';
|
|||||||
function DecalCreator() {
|
function DecalCreator() {
|
||||||
const { wallStore, floorStore } = useSceneContext();
|
const { wallStore, floorStore } = useSceneContext();
|
||||||
const { addDecal: addDecalOnWall, getWallById } = wallStore();
|
const { addDecal: addDecalOnWall, getWallById } = wallStore();
|
||||||
const { addDecal : addDecalOnFloor, getFloorById } = floorStore();
|
const { addDecal: addDecalOnFloor, getFloorById } = floorStore();
|
||||||
const { droppedDecal } = useDroppedDecal();
|
const { droppedDecal } = useDroppedDecal();
|
||||||
const { activeModule } = useModuleStore();
|
const { activeModule } = useModuleStore();
|
||||||
const { userId, organization } = getUserData();
|
const { userId, organization } = getUserData();
|
||||||
@@ -36,6 +36,7 @@ function DecalCreator() {
|
|||||||
const intersects = raycaster.intersectObjects(scene.children, true);
|
const intersects = raycaster.intersectObjects(scene.children, true);
|
||||||
const wallIntersect = intersects.find(i => i.object.userData && i.object.userData.wallUuid);
|
const wallIntersect = intersects.find(i => i.object.userData && i.object.userData.wallUuid);
|
||||||
const floorIntersect = intersects.find(i => i.object.userData && i.object.userData.floorUuid);
|
const floorIntersect = intersects.find(i => i.object.userData && i.object.userData.floorUuid);
|
||||||
|
console.log('wallIntersect: ', wallIntersect);
|
||||||
|
|
||||||
if (wallIntersect) {
|
if (wallIntersect) {
|
||||||
const wall = getWallById(wallIntersect.object.userData.wallUuid);
|
const wall = getWallById(wallIntersect.object.userData.wallUuid);
|
||||||
@@ -51,7 +52,7 @@ function DecalCreator() {
|
|||||||
type: 'Wall',
|
type: 'Wall',
|
||||||
wallUuid: wallIntersect.object.userData.wallUuid,
|
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,
|
decalRotation: 0,
|
||||||
decalOpacity: 1,
|
decalOpacity: 1,
|
||||||
decalScale: 1,
|
decalScale: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user