fix: [rd] 복주머니+플랜지를 모터 그룹으로 이동

- 모터 숨기면 복주머니+플랜지도 함께 숨김
- 샤프트는 복주머니 없이 자기 구간까지만 표시
- 모터 ON: 브라켓 ← 모터 ← 출력축 ← 복주머니 ← 샤프트
- 모터 OFF: 샤프트만 남음 (비모터측 브라켓+환봉까지)
This commit is contained in:
김보곤
2026-03-08 22:12:33 +09:00
parent 11af8e2a6a
commit b3cd1ffebc

View File

@@ -1087,33 +1087,34 @@ function fs3dBuild() {
msMesh.position.set(msCenterX, 0, 0);
meshes.shaft.add(msMesh);
// --- Motor side: 복주머니 (모터 돌출축 + 샤프트를 감싸는 커플링) ---
// 외통 (샤프트보다 큰 원통 — 모터축과 샤프트관을 메우는 결합부)
const cpGeo = new THREE.CylinderGeometry(couplingDia / 2, couplingDia / 2, couplingLen, 24);
cpGeo.rotateZ(Math.PI / 2);
const cpMat = new THREE.MeshStandardMaterial({ color: 0x78716c, metalness: 0.7, roughness: 0.2 });
const cpMesh = new THREE.Mesh(cpGeo, cpMat);
// --- Motor side: 복주머니+플랜지는 모터 그룹에 추가 (아래 모터 섹션에서 생성) ---
// cpCenterX, couplingDia 등은 모터 섹션에서 사용
const cpCenterX = motorDir * (W1 / 2 - couplingLen / 2);
cpMesh.position.set(cpCenterX, 0, 0);
meshes.shaft.add(cpMesh);
// 플랜지 링 (모터 출력축과의 결합면)
const flangeGeo = new THREE.CylinderGeometry(couplingDia / 2 + 10, couplingDia / 2 + 10, 6, 24);
flangeGeo.rotateZ(Math.PI / 2);
const flangeMat = new THREE.MeshStandardMaterial({ color: 0x57534e, metalness: 0.8, roughness: 0.2 });
const flange = new THREE.Mesh(flangeGeo, flangeMat);
flange.position.set(motorDir * (W1 / 2 - 3), 0, 0);
meshes.shaft.add(flange);
meshes.shaft.position.set(0, shaftY, 0);
scene.add(meshes.shaft);
// === MOTOR (DH-150K/300K 스타일: 본체 + 기어박스 + 베이스 + 다리) ===
// === MOTOR (DH-150K/300K 스타일: 복주머니 + 본체 + 기어박스 + 베이스 + 다리) ===
meshes.motor = new THREE.Group();
const motorR = b.shaftDia * 0.6; // 모터 반지름 (샤프트 1.2배)
const metalMat = new THREE.MeshStandardMaterial({ color: 0x94a3b8, metalness: 0.6, roughness: 0.3 });
const darkMat = new THREE.MeshStandardMaterial({ color: 0x374151, metalness: 0.5, roughness: 0.4 });
const blueMat = new THREE.MeshStandardMaterial({ color: 0x2563eb, metalness: 0.4, roughness: 0.4 });
// 0) 복주머니 + 플랜지 (모터 그룹 소속 — 모터 숨기면 함께 숨김)
const cpGeo = new THREE.CylinderGeometry(couplingDia / 2, couplingDia / 2, couplingLen, 24);
cpGeo.rotateZ(Math.PI / 2);
const cpMat = new THREE.MeshStandardMaterial({ color: 0x78716c, metalness: 0.7, roughness: 0.2 });
const cpMesh = new THREE.Mesh(cpGeo, cpMat);
cpMesh.position.set(cpCenterX, 0, 0);
meshes.motor.add(cpMesh);
const flangeGeo = new THREE.CylinderGeometry(couplingDia / 2 + 10, couplingDia / 2 + 10, 6, 24);
flangeGeo.rotateZ(Math.PI / 2);
const flangeMat = new THREE.MeshStandardMaterial({ color: 0x57534e, metalness: 0.8, roughness: 0.2 });
const flange = new THREE.Mesh(flangeGeo, flangeMat);
flange.position.set(motorDir * (W1 / 2 - 3), 0, 0);
meshes.motor.add(flange);
// 모터 위치: 브라켓 안쪽, 복주머니 옆
const motorBodyLen = motorR * 2.5; // 본체 길이
const gearBoxLen = motorR * 1.2; // 기어박스 길이