Three.js:根据世界向量设置位置

时间:2015-07-30 04:40:15

标签: javascript three.js

我正在尝试将网格的位置更新为全局坐标。但是,当我这样做时,结果非常不准确。

// converting global to local
local = mesh.worldToLocal(position.clone())

// converting back to verify it is accurate
globalpos = mesh.localToWorld(local.clone())

// taking a snapshot for comparision
orig = mesh.position.clone()

// should just need to add the local vector, 
// as it is local to the mesh position
mesh.position.add(local)

// printing for debug
console.log(position, globalpos, orig, local, mesh.position)

positionglobalpos始终相同。所以似乎数学并没有失去那么多的精度,但是网格位置可能会相当大(我观察到.3在一种情况下存在差异)

这应该怎么做?

使用三个r71

0 个答案:

没有答案