This commit is contained in:
2026-05-13 15:13:16 +08:00
parent 52b369737a
commit fea24ad19a
2 changed files with 20 additions and 12 deletions

View File

@ -329,8 +329,8 @@
</div>
<div class="category-content">
<div class="option-group">
<button class="option-btn" data-option="louver-1">111</button>
<button class="option-btn" data-option="louver-2">百叶2</button>
<button class="option-btn" data-option="louver-1">整体</button>
<button class="option-btn" data-option="louver-2">3m百叶</button>
<button class="option-btn" data-option="louver-3">百叶3</button>
<button class="option-btn" data-option="louver-4">百叶4</button>
<button class="option-btn" data-option="louver-4">卷帘小</button>
@ -519,7 +519,11 @@
let sku = ""
const skuToFunc = async (currentText) => {
sku = currentText;
placementWall(1);
if(currentText.includes("3m")){
await placementWall(3);
}else{
await placementWall(1);
}
}
@ -814,8 +818,8 @@
},
{
name: 'back',
startPoint: [1.37, baseY, 1.4],
endPoint: [-1.43, baseY, 1.4],
startPoint: [1.4, baseY, 1.4],
endPoint: [-1.43, baseY, 1.37],
height: 2.2,
divisions: divisions,
offset: wallOffset
@ -852,6 +856,8 @@
// 监听放置区域点击事件
kernel.on('dropzone:click', async (dropzone_data) => {
console.log(dropzone_data);
const { position, rotation } = dropzone_data.transform;
// 将模型放置到该区域
@ -866,11 +872,13 @@
// 使用 for...of 循环以支持 await
for (const event of result.data.events) {
if (event.event_type === 'change_model') {
const { file_url, model_control_type, category } = event.target_data;
console.log('替换百叶模型:', event);
console.log( event.target_data);
await kernel.model.replace({
modelId: category,
const {id, name,file_url, model_control_type, category } = event.target_data;
console.log('替换百叶模型:', event);
console.log('替换百叶模型类型:', category);
await kernel.model.add({
modelId: id+Date.now(),
modelUrl: file_url,
modelControlType: model_control_type,
drag: {
@ -885,7 +893,7 @@
}
});
console.log(`百叶模型已替换为 ${currentText}`);
console.log(`百叶模型已替换为 ${name}`);
}
if (event.event_type === 'change_color') {

View File

@ -93,7 +93,7 @@ class AppRay extends Monobehiver {
const clickedZone = zones.find(zone => zone.mesh === pickInfo.pickedMesh);
if (clickedZone) {
// 计算该放置区域的目标位置和旋转
const offsetDistance = 0.1;
const offsetDistance = 0.05; // 增加偏移距离,让模型更往外
const targetPosition = clickedZone.center.add(clickedZone.normal.scale(offsetDistance));
const targetDirection = clickedZone.normal.scale(-1);
const angle = Math.atan2(targetDirection.x, targetDirection.z);