[英]updating mesh geometry in Three.js?
I have two meshes: mesh1 and mesh2. 我有两个网格物体:mesh1和mesh2。 both have the same number of vertices and have extrusion.
都具有相同数量的顶点并具有拉伸。
mesh1 = 5000 vertices.
mesh2 = 5000 vertices.
I assign the vertices of mesh2 to mesh1. 我将mesh2的顶点分配给mesh1。 then I do:
然后我做:
mesh2.geometry.verticesNeedUpdate = true;
mesh2.geometry.vertices = mesh1.geometry.vertices;
thus the vertices of mesh2 are updated. 从而更新了mesh2的顶点。 but this happens too fast.
但这发生得太快了。 I can not see an animation while it makes mesh2's vertices to mesh1's vertices.
在将mesh2的顶点变为mesh1的顶点时,我看不到动画。
I want to see the transformation when malla2 starts to become the malla1, I mean to see an animation of vertices when they are changing. 我想看到Malla2开始变成Malla1时的变换,我的意思是看到顶点变化时的动画。
I used "Tween.js" for animations such as position and color. 我将“ Tween.js”用于动画,例如位置和颜色。 I'm not sure if this can help to view animations when vertices begin to change.
我不确定这在顶点开始变化时是否可以帮助查看动画。
I do: 我做:
new TWEEN.Tween( mesh2.geometry.vertices ).to( mesh1.geometry.vertices, 1000 ).start();
but not works. 但不起作用。 sorry for my level of english.
对不起,我的英语水平。
As you've seen, this doesn't work -- in part because for each call to update the mesh vertices, you must also call geometry2.verticesNeedUpdate = true;
如您所见,这是行不通的,部分原因是每次调用更新网格顶点时,您还必须调用
geometry2.verticesNeedUpdate = true;
for every one of these frames. 这些帧中的每一个。
-- -
more specifically I think you will want to add .onUpdate(function() { geometry2.verticesNeedUpdate = true; })
to your tween. 更具体地说,我认为您将需要在补间中添加
.onUpdate(function() { geometry2.verticesNeedUpdate = true; })
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.