I'm encountering an issue where the use of translate[X|Y|Z]
on my object results in its position becoming distorted and only displaying NaN
values.
Using Three.js r70
The relative position differs from the absolute position:
Snippet from my code
if (!this.following) return false;
var mesh = this.get(); //Single mesh
this.mesh.lookAt(this.mesh.worldToLocal((new THREE.Vector3(0, 0, 0)).setFromMatrixPosition(this.following.whom.matrixWorld))); //this.following.whom refers to another mesh
var followerPosition = mesh.localToWorld(new THREE.Vector3(0, 0, 0));
var followeePosition = this.following.whom.localToWorld(new THREE.Vector3(0, 0, 0));
var distance = followerPosition.distanceTo(followeePosition);
if (distance > this.following.distance) { //this.following.distance is a scalar value
mesh.translateZ(distance * 0.02);
}
return true;
What could I be doing incorrectly? Is it not appropriate to use transformZ with relative values?