Hey im creating a type go mountain in my scene and want to let the tops of it wiggle to specific values. Now im trying to access the vertices I've set before and specify them again over time trough the update function. How do I access them probably and recalculate the faces?
geom1.vertices = [
new THREE.Vector3( -1000, -300, 0 ),
new THREE.Vector3( -1000, 0, 0 ),
new THREE.Vector3( -20, 120, 0 ),
new THREE.Vector3( 60, 85, 0 ),
new THREE.Vector3( 140, 100, 0 ),
new THREE.Vector3( 1000, 0, 0 ),
new THREE.Vector3( 1000, -300, 0 ),
new THREE.Vector3( 0, -300 , 0 ),
];
geom1.faces = [
new THREE.Face3( 7, 0, 1 ),
new THREE.Face3( 7, 1, 2 ),
new THREE.Face3( 7, 2, 3 ),
new THREE.Face3( 7, 3, 4 ),
new THREE.Face3( 7, 4, 5 ),
new THREE.Face3( 7, 5, 6 ),
];
geom1.computeFaceNormals();
geom1.dynamic = true;
var material1 = new THREE.MeshBasicMaterial( {
color: 0x7dae81,
side: THREE.DoubleSide,
} );
hill1 = new THREE.Mesh( geom1, material1);
in the update function im doing this
geom1.vertices[2].y += 0.1;
geom1.verticesNeedUpdate;
You need to set
geometry.verticesNeedUpdate = true;
For more information, see verticesNeedUpdate in Three.js.
Also, Geometry
does not have a dynamic
property.
three.js r.85