1
This commit is contained in:
@ -92,6 +92,12 @@ class AppRay extends Monobehiver {
|
||||
const zones = this.mainApp.appDropZone.getPlacementZones();
|
||||
const clickedZone = zones.find(zone => zone.mesh === pickInfo.pickedMesh);
|
||||
if (clickedZone) {
|
||||
// 计算该放置区域的目标位置和旋转
|
||||
const offsetDistance = 0.1;
|
||||
const targetPosition = clickedZone.center.add(clickedZone.normal.scale(offsetDistance));
|
||||
const targetDirection = clickedZone.normal.scale(-1);
|
||||
const angle = Math.atan2(targetDirection.x, targetDirection.z);
|
||||
|
||||
EventBridge.dropZoneClick({
|
||||
wallName: clickedZone.wallName,
|
||||
index: clickedZone.index,
|
||||
@ -99,7 +105,24 @@ class AppRay extends Monobehiver {
|
||||
width: clickedZone.width,
|
||||
height: clickedZone.height,
|
||||
normal: clickedZone.normal,
|
||||
mesh: clickedZone.mesh
|
||||
mesh: clickedZone.mesh,
|
||||
transform: {
|
||||
position: {
|
||||
x: targetPosition.x,
|
||||
y: targetPosition.y,
|
||||
z: targetPosition.z
|
||||
},
|
||||
rotation: {
|
||||
x: 0,
|
||||
y: angle * 180 / Math.PI, // 转换为角度
|
||||
z: 0
|
||||
},
|
||||
scale: {
|
||||
x: 1,
|
||||
y: 1,
|
||||
z: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user