three.js: vertices need update not working - r72
With r71 I could update vertices of my BoxGeometry for as below:
var vertices = [];
vertices.push(new THREE.Vector3(0.5, 0.5, 0.5));
vertices.push(new THREE.Vector3(0.5, 0.5, -0.5));
vertices.push(new THREE.Vector3(0.5, -0.5, 0.5));
vertices.push(new THREE.Vector3(0.5, -0.5, -0.5));
vertices.push(new THREE.Vector3(-0.5, 0.5, -0.5));
vertices.push(new THREE.Vector3(-0.5, 0.5, 0.5));
vertices.push(new THREE.Vector3(-0.5, -0.5, -0.5));
vertices.push(new THREE.Vector3(-0.5, -0.5, 0.5));
this._mesh.geometry.vertices = vertices;
this._mesh.geometry.applyMatrix(
new THREE.Matrix4().makeTranslation(
dataCoordinates.x,
dataCoordinates.y,
dataCoordinates.z));
this._mesh.geometry.verticesNeedUpdate = true;
It doesn’t work anymore on r72.
It doesn’t raise any error.
Is it supposed to work? If not, which is the current best practice to update vertices of a geometry?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 30 (14 by maintainers)
Commits related to this issue
- BufferGeometry.updateFromObject() uvs handling. Thanks @WestLangley. See #7179. — committed to mrdoob/three.js by mrdoob 9 years ago
- three: fix uvsNeedUpdate not working - see https://github.com/mrdoob/three.js/issues/7179 — committed to ironbane/ironbane by nickjanssen 9 years ago
I vote to consider reassignment as an invalid operation and close the issue.
Is this open issue still not fixed?
Seems like a workaround is to do
delete box.geometry.__directGeometry;
. Maybe we can do add a new flag that recreated theDirectGeometry
.@jniac Please read my comments above. Change UV values using
Vector2.set()
– do not replace thefaceVertexUvs
array.@WestLangley Thanks - just calling “set” on every single vertex of the vertices array seems to work.
r72 (working): http://codepen.io/nicolasrannou/pen/zvqyrj