0
看起來,當我在我的對象上使用translate[X|Y|Z]
時,它的位置會受到損壞,並且只包含NaN
值。Three.js object3d.translateZ導致所有位置值中的NaN
three.js所R70
的位置是相對的,絕對是不同的:
我的代碼
if (!this.following) return false;
var mesh = this.get(); //One mesh
this.mesh.lookAt(this.mesh.worldToLocal((new THREE.Vector3(0, 0, 0)).setFromMatrixPosition(this.following.whom.matrixWorld))); //this.following.whom is 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 scalar value
mesh.translateZ(distance * 0.02);
}
return true;
我在做什麼錯?在處理相對值時,我不能使用transformZ嗎?
你的代碼到底是什麼。你只是顯示結果。 – gaitat
使用three.js的非縮小版本並使用調試器。 – WestLangley
我已經添加了我的代碼 – Misiur