From 3422214f8d6dc1928e0ace6e030c713fe248e739 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 1 Nov 2022 13:30:22 -0400 Subject: [PATCH] update face selection to track indexed parts --- src/kiri/tools.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/kiri/tools.js b/src/kiri/tools.js index 0951cded..2d755847 100644 --- a/src/kiri/tools.js +++ b/src/kiri/tools.js @@ -115,11 +115,18 @@ api.event.on('mouse.hover', (ev) => { let opos = track.pos; obj.add(pmesh); pmesh.position.x = point.x - opos.x + norm.x * 0.1; - pmesh.position.y = -point.z - opos.y + norm.y * 0.1; - pmesh.position.z = point.y + norm.z * 0.1; - // todo also need to account for z top offset in cam mode if (track.indexed) { - pmesh.position.z += track.indexed / 2 + track.tzoff; + let delta = track.delta; + let rad = track.indexRad; + let py = (point.y - delta.z + track.tzoff) * 1.001; + let pz = (point.z + delta.y) * 1.001; + let v = new THREE.Vector3(point.x, py, pz) + .applyAxisAngle(new THREE.Vector3(1,0,0), rad); + pmesh.position.y = -v.z; + pmesh.position.z = v.y; + } else { + pmesh.position.y = -point.z - opos.y + norm.y * 0.1; + pmesh.position.z = point.y + norm.z * 0.1; } let q = new Quaternion().setFromUnitVectors( new Vector3(0,0,1),