Hey there
I made a script for changing a mesh in realtime and it worked.
The problem is, that this script was not efficient enough and had to be modified.
this is the script:
mesh.vertices[triangles[hit.triangleIndex * 3 + 0]]=new Vector3(0.0f, 0.0f, 0.0f);
but this line does not work.
Instead of this line I had a new array of vertices, but my object is around 14.000 vertices. So two arrays of this size like:
mesh.vertices = tempVerticies;
It worked, but is not good at all.
So my question:
How I can change only one object in a Vector3 array?
Thanks a lot for help
Dub
Eric5h5
November 19, 2014, 7:33pm
2
You can’t do that; you must get all the vertices, change one, then upload the vertices again. You can just do the “get all vertices” step once and keep the array around if you’re going to be modifying the vertices frequently. The vertices exist on the GPU so it’s not as simple as changing an entry in an ordinary array.
–Eric
1 Like
Eric5h5:
You can’t do that; you must get all the vertices, change one, then upload the vertices again. You can just do the “get all vertices” step once and keep the array around if you’re going to be modifying the vertices frequently. The vertices exist on the GPU so it’s not as simple as changing an entry in an ordinary array.
–Eric
Thanks for the reply
is there no other way to update a meshs vertices?