旋转或移动对象后如何更新顶点几何体 [英] How to update vertices geometry after rotate or move object
问题描述
我可以使用位置&用于变换网格的旋转值.
I can use position & rotation values to transform a mesh.
好的,我看到更改看起来如何正确,但我想要一种方法来转换几何顶点 x、y、z、释放和/或重置旋转和位置值.我不知道该怎么做....
Ok, I see how the changes looks right but I'd want a way to transform the geometry vertices x,y,z, freeing and/or reseting the rotation & position values. I dont't know how to do it....
我玩过:
myobj.applymatrix();
myobj.matrixAutoUpdate = false;
myobj.verticesNeedUpdate;
而不是设置位置 &旋转,但结果是一样的:是的,变化是正确的,但内部几何形状没有变化.
instead of setting position & rotation, but the result is the same: Yes, the changes are right but the internal geometry did not change.
我必须手动将几何变换应用于顶点吗?
Have I to apply the geometric transform to vertices manually ?
任何帮助将不胜感激!
推荐答案
如果要变换几何体的顶点,请使用以下模式:
If you want to transform the vertices of your geometry, use this pattern:
mesh.updateMatrix();
mesh.geometry.applyMatrix( mesh.matrix );
mesh.matrix.identity();
然后将 position
、rotation
和 scale
属性重置为它们的初始值:
Then reset the position
, rotation
, and scale
properties to their initial values:
mesh.position.set( 0, 0, 0 );
mesh.rotation.set( 0, 0, 0 );
mesh.scale.set( 1, 1, 1 );
three.js r.85
three.js r.85
这篇关于旋转或移动对象后如何更新顶点几何体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!