Dynamically changed shape's vertex not working?
See original GitHub issueI have a model loaded with jsonloader, and add the mesh to scene using the callback function
function addCube( p, g) {
var materials = [
new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true, transparent: true } )];
mesh = new THREE.Mesh( g, materials );
mesh.position = p;
scene.addObject( mesh );
};
However, when I try to dynamically changed the mesh 's vertex position, it seems to fail to reach the geometry of the mesh, the shape of the mesh is not affected at all even if I set the .__dirtyVertices to be true;
for(i=0;i<meshGeometry.vertieces.length;i++)
{
mesh.geometry.vertices[i].position.x-=shiftX;
mesh.geometry.vertices[i].position.y-=shiftY;
mesh.geometry.vertices[i].position.z-=shiftZ;
}
mesh.geometry.__dirtyVertices = true;
And the system give an uncaught typeerror, it seems that the browser failed to access the mesh geometry.
Is it because the mesh creation is done in the callback function? I look at another demo here http://mrdoob.github.com/three.js/examples/webgl_ribbons.html
the mesh creation is done outside the callback funciton, and the mesh vertex position could be dynamiclly changed.
Can anyone tell me how to find a way to solve this problem?
Issue Analytics
- State:
- Created 12 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Vertex shape move: vertices not changing - Google Groups
I've been working on a vertex shape move code however, the vertices are not changing. I am wondering if there's something missing in...
Read more >three js vertices does not update - Stack Overflow
After rendering, you need to reset the needsUpdate flag to true every time the attribute values are changed. three.js r.147.
Read more >Geometry Nodes - dynamic vertices count of mesh / Error
I have been stuck for the whole afternoon now and I hope that someone has a clue how to solve my problem. I...
Read more >Dynamic Batching not working even adhering to all rules
Unity shows the vertex count being under 900. Using most simple shader (only a color is output). Forward render mode. No Transparency or...
Read more >Dynamically Morph A Mesh | Babylon.js Documentation
For now, it concerns only ribbons, tubes, extruded shapes and lines. When talking about morphing, we mean here changing the vertices positions of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sorry for not posting the codes, I have solved the problem, by simply setting geometry 's dynamic attributes to be true, geometry.dynamic=true, the problem is solved!
Erm, yes - that would be the problem! 😃