1
This commit is contained in:
28
index.html
28
index.html
@ -329,8 +329,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="category-content">
|
<div class="category-content">
|
||||||
<div class="option-group">
|
<div class="option-group">
|
||||||
<button class="option-btn" data-option="louver-1">111</button>
|
<button class="option-btn" data-option="louver-1">整体</button>
|
||||||
<button class="option-btn" data-option="louver-2">百叶2</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-3">百叶3</button>
|
||||||
<button class="option-btn" data-option="louver-4">百叶4</button>
|
<button class="option-btn" data-option="louver-4">百叶4</button>
|
||||||
<button class="option-btn" data-option="louver-4">卷帘小</button>
|
<button class="option-btn" data-option="louver-4">卷帘小</button>
|
||||||
@ -519,7 +519,11 @@
|
|||||||
let sku = ""
|
let sku = ""
|
||||||
const skuToFunc = async (currentText) => {
|
const skuToFunc = async (currentText) => {
|
||||||
sku = currentText;
|
sku = currentText;
|
||||||
placementWall(1);
|
if(currentText.includes("3m")){
|
||||||
|
await placementWall(3);
|
||||||
|
}else{
|
||||||
|
await placementWall(1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,8 +818,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'back',
|
name: 'back',
|
||||||
startPoint: [1.37, baseY, 1.4],
|
startPoint: [1.4, baseY, 1.4],
|
||||||
endPoint: [-1.43, baseY, 1.4],
|
endPoint: [-1.43, baseY, 1.37],
|
||||||
height: 2.2,
|
height: 2.2,
|
||||||
divisions: divisions,
|
divisions: divisions,
|
||||||
offset: wallOffset
|
offset: wallOffset
|
||||||
@ -852,6 +856,8 @@
|
|||||||
|
|
||||||
// 监听放置区域点击事件
|
// 监听放置区域点击事件
|
||||||
kernel.on('dropzone:click', async (dropzone_data) => {
|
kernel.on('dropzone:click', async (dropzone_data) => {
|
||||||
|
console.log(dropzone_data);
|
||||||
|
|
||||||
const { position, rotation } = dropzone_data.transform;
|
const { position, rotation } = dropzone_data.transform;
|
||||||
|
|
||||||
// 将模型放置到该区域
|
// 将模型放置到该区域
|
||||||
@ -866,11 +872,13 @@
|
|||||||
// 使用 for...of 循环以支持 await
|
// 使用 for...of 循环以支持 await
|
||||||
for (const event of result.data.events) {
|
for (const event of result.data.events) {
|
||||||
if (event.event_type === 'change_model') {
|
if (event.event_type === 'change_model') {
|
||||||
const { file_url, model_control_type, category } = event.target_data;
|
console.log( event.target_data);
|
||||||
console.log('替换百叶模型:', event);
|
|
||||||
|
|
||||||
await kernel.model.replace({
|
const {id, name,file_url, model_control_type, category } = event.target_data;
|
||||||
modelId: category,
|
console.log('替换百叶模型:', event);
|
||||||
|
console.log('替换百叶模型类型:', category);
|
||||||
|
await kernel.model.add({
|
||||||
|
modelId: id+Date.now(),
|
||||||
modelUrl: file_url,
|
modelUrl: file_url,
|
||||||
modelControlType: model_control_type,
|
modelControlType: model_control_type,
|
||||||
drag: {
|
drag: {
|
||||||
@ -885,7 +893,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`百叶模型已替换为 ${currentText}`);
|
console.log(`百叶模型已替换为 ${name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.event_type === 'change_color') {
|
if (event.event_type === 'change_color') {
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class AppRay extends Monobehiver {
|
|||||||
const clickedZone = zones.find(zone => zone.mesh === pickInfo.pickedMesh);
|
const clickedZone = zones.find(zone => zone.mesh === pickInfo.pickedMesh);
|
||||||
if (clickedZone) {
|
if (clickedZone) {
|
||||||
// 计算该放置区域的目标位置和旋转
|
// 计算该放置区域的目标位置和旋转
|
||||||
const offsetDistance = 0.1;
|
const offsetDistance = 0.05; // 增加偏移距离,让模型更往外
|
||||||
const targetPosition = clickedZone.center.add(clickedZone.normal.scale(offsetDistance));
|
const targetPosition = clickedZone.center.add(clickedZone.normal.scale(offsetDistance));
|
||||||
const targetDirection = clickedZone.normal.scale(-1);
|
const targetDirection = clickedZone.normal.scale(-1);
|
||||||
const angle = Math.atan2(targetDirection.x, targetDirection.z);
|
const angle = Math.atan2(targetDirection.x, targetDirection.z);
|
||||||
|
|||||||
Reference in New Issue
Block a user