highlight wobelling + started console exec

This commit is contained in:
STEINNI
2025-11-17 20:52:38 +00:00
parent aa5b77f65b
commit a0a0bba6f8
5 changed files with 53 additions and 37 deletions
+21 -8
View File
@@ -122,10 +122,10 @@ app.helpers.helpers3D = {
outlineMaterial: new THREE.MeshBasicMaterial({
color: 0xffff00,
color: 0xFFFFFF,
side: THREE.BackSide,
transparent: true,
opacity: 0.5,
opacity: 0.8,
depthTest: true,
depthWrite: false,
stencilWrite: true,
@@ -148,16 +148,17 @@ app.helpers.helpers3D = {
}),
highlight3DObj(obj, scene) {
this.highlightedObj = obj
// Scaled up Mesh to stencil
obj.traverse(child => {
if (child.isMesh) {
const inflated = new THREE.Mesh(child.geometry, this.outlineMaterial)
inflated.position.copy(child.getWorldPosition(new THREE.Vector3()))
inflated.quaternion.copy(child.getWorldQuaternion(new THREE.Quaternion()))
inflated.scale.copy(child.getWorldScale(new THREE.Vector3())).multiplyScalar(1.05)
const highlightInflatedMesh = new THREE.Mesh(child.geometry, this.outlineMaterial)
highlightInflatedMesh.position.copy(child.getWorldPosition(new THREE.Vector3()))
highlightInflatedMesh.quaternion.copy(child.getWorldQuaternion(new THREE.Quaternion()))
highlightInflatedMesh.scale.copy(child.getWorldScale(new THREE.Vector3())).multiplyScalar(1.05)
scene.add(inflated)
child._outlineMesh = inflated
scene.add(highlightInflatedMesh)
child._outlineMesh = highlightInflatedMesh
}
})
@@ -171,6 +172,7 @@ app.helpers.helpers3D = {
},
clearHighlight3DObj(obj,scene) {
this.highlightedObj = null
obj.traverse(child => {
if (child._outlineMesh) {
scene.remove(child._outlineMesh)
@@ -186,6 +188,17 @@ app.helpers.helpers3D = {
})
},
animateHighlight3DObj() {
if(!this.highlightedObj) return
const t = performance.now() * 0.002
const scale = 1.05 + Math.sin(t * 2) * 0.03
this.highlightedObj.traverse(child => {
if (child._outlineMesh) {
child._outlineMesh.scale.set(scale, scale, scale)
}
})
},
makePivotAtGeomCenter(object, scene) {
object.updateWorldMatrix(true, true)
const box = new THREE.Box3().setFromObject(object)