diff --git a/api/animate.js b/api/animate.js index 2de74545..32bb8d20 100644 --- a/api/animate.js +++ b/api/animate.js @@ -1340,7 +1340,7 @@ export const flockAnimate = { if (!animName || !scene) return { name: null, isLooping: false, isPlaying: false }; - // Your groups are named like `${mesh.name}.${animName}` + // groups are named like `${mesh.name}.${animName}` const expectedGroupName = `${mesh.name}.${animName}`; const group = diff --git a/api/camera.js b/api/camera.js index 717a86c6..3b5cafcb 100644 --- a/api/camera.js +++ b/api/camera.js @@ -199,12 +199,12 @@ export const flockCamera = { } } - // position the anchor under the mesh so it doesn’t introduce sideways torque + // position the anchor under the mesh out of the way const meshWorldPos = mesh.getAbsolutePosition ? mesh.getAbsolutePosition() : mesh.position.clone(); constraintBox.position.copyFrom(meshWorldPos); - constraintBox.position.y += -4; // keep your original -4 offset + constraintBox.position.y += -4; // keep original -4 offset constraintBox.computeWorldMatrix(true); if (constraintBox.physics) { @@ -261,14 +261,12 @@ export const flockCamera = { ) return; try { - // preserve Y motion; zero X/Z linear velocity *only if you really want to block sliding*. - // If sideways walking causes spin, comment the next two lines so movement isn't fighting physics. + // preserve Y motion; zero X/Z linear velocity const v = mesh.physics.getLinearVelocity(); mesh.physics.setLinearVelocity( new flock.BABYLON.Vector3(0, v.y, 0), ); - // keep yaw free; kill roll/pitch mesh.physics.setAngularVelocity(new flock.BABYLON.Vector3(0, 0, 0)); } catch (err) { console.warn("Physics body became invalid:", err); diff --git a/api/csg.js b/api/csg.js index 221b5d9a..cb6c064e 100644 --- a/api/csg.js +++ b/api/csg.js @@ -640,7 +640,7 @@ export const flockCSG = { return resolve(null); } - // Align pivot and position (Maintain your original behavior) + // Align pivot and position const localCenter = resultMesh .getBoundingInfo() .boundingBox.center.clone(); diff --git a/api/material.js b/api/material.js index 4eec855d..32602de4 100644 --- a/api/material.js +++ b/api/material.js @@ -354,7 +354,7 @@ export const flockMaterial = { // Helper function to copy color properties from PBR to Standard material const copyColorProperties = (pbrMaterial, standardMaterial) => { - // Check for albedoColor first (as seen in your debug output) + // Check for albedoColor first if (pbrMaterial.albedoColor) { standardMaterial.diffuseColor = pbrMaterial.albedoColor.clone(); } @@ -1561,8 +1561,6 @@ export const flockMaterial = { const texName = String(getTexName(v)); const alpha = getAlpha(v); - // This matches your existing cache key convention closely while also - // respecting alpha when it’s provided via descriptor or opts. return `mat_${resolvedHex.toLowerCase()}_${alpha}_${texName}`.toLowerCase(); }; diff --git a/api/mesh.js b/api/mesh.js index 70ad33ed..f5c0a35f 100644 --- a/api/mesh.js +++ b/api/mesh.js @@ -164,7 +164,6 @@ export const flockMesh = { return shape; }, // backRatio: signed fraction of mesh size along the chosen axis (e.g., 0.25 = 25% back; -0.25 = 25% forward) - // axis: "z" (default) if your rig faces ±Z; use "x" if it faces ±X createSittingCapsuleFromBoundingBox( mesh, scene, diff --git a/api/physics.js b/api/physics.js index 932409cf..51343b95 100644 --- a/api/physics.js +++ b/api/physics.js @@ -216,6 +216,7 @@ export const flockPhysics = { mesh.computeWorldMatrix(true); }); }); + return beforePhysicsObserver; }, up(meshName, upForce = 10) { const mesh = flock.scene.getMeshByName(meshName); @@ -346,7 +347,7 @@ export const flockPhysics = { const applyMeshPhysicsShape = (targetMesh) => { const { motionType, disablePreStep } = capturePhysicsState(targetMesh); - // Keep your original material gate + if (!targetMesh.material) { disposePhysics(targetMesh); return; @@ -549,7 +550,7 @@ export const flockPhysics = { await executeAction(meshId); }); - // 👓 Re-integrating your XR Logic + // XR case if (flock.xrHelper && flock.xrHelper.baseExperience) { flock.xrHelper.baseExperience.onStateChangedObservable.add( (state) => { @@ -805,9 +806,8 @@ export const flockPhysics = { } catch (_) {} }); - // If the caller asked for a specific trigger callback semantics (e.g. Exit), + // If the caller asks for a specific trigger callback semantics (e.g. Exit), // also register their requested trigger to invoke the callback directly. - // This preserves your original API behavior. if ( trigger && B.ActionManager[trigger] && diff --git a/api/sensing.js b/api/sensing.js index 2e8a88fb..d162600f 100644 --- a/api/sensing.js +++ b/api/sensing.js @@ -169,7 +169,6 @@ export const flockSensing = { propertyValue = mesh.isEnabled() && mesh.isVisible; break; - // Leaving colour-related logic as-is for now, per your request. case "ALPHA": allMeshes = [mesh].concat(mesh.getDescendants?.() ?? []); materialNode = allMeshes.find((node) => node.material); diff --git a/api/transform.js b/api/transform.js index f978d62c..78282bf0 100644 --- a/api/transform.js +++ b/api/transform.js @@ -866,7 +866,6 @@ export const flockTransform = { wmBefore, ); - // Apply new pivot to mesh (and children, per your existing behavior) mesh.setPivotPoint(newPivotLocal); mesh .getChildMeshes()