How to modify existing mesh?
Posted: Tue Apr 26, 2016 10:06 am
Hi,
I have a problem understanding how to modify a previously created mesh.
When I read the documentation I´m just getting confused. It says that using CreateMesh() you can set a mesh to be either Static or Dynamic and only Dynamic can be updated. So far so good.
But the example "SetMeshData.pb" changes the mesh on a Static mesh using SetMeshData() so why does this work? Is this command just an exception to the Static/Dynamic rule?
And how do I create a dynamic mesh? Whatever I chose with the CreateMesh() command seems to be overwritten by the FinishMesh() command which converts it to either a Static(#True) or Dynamic(#False). So what´s the point of having that option with the CreateMesh() command?
Also whenever I use FinishMesh(#False) my application doesn´t display the created mesh at all and when I close the application it just crashes instead of just exiting. This tells me that there are differences in capabilities between Static and Dynamic meshes, but what?
So how should I best create and modify a mesh in realtime? I want to be able to change vertexcoordinates, normals, UVs, adding/removing vertices and triangles. Basically everything.
Another issue is how I get the specific vertex or triangle I want to change. All the commands seems to loop through from the beginning and this is a problem if I want to have each vertex and triangle set as an indexnumber.
Imagine I create a 3D tool like Lightwave and 3DStudioMax. I need to control the mesh completely. Selecting a vertex or triangle and changing all values on that.
How would I accomplish that?
//Andreas..
I have a problem understanding how to modify a previously created mesh.
When I read the documentation I´m just getting confused. It says that using CreateMesh() you can set a mesh to be either Static or Dynamic and only Dynamic can be updated. So far so good.
But the example "SetMeshData.pb" changes the mesh on a Static mesh using SetMeshData() so why does this work? Is this command just an exception to the Static/Dynamic rule?
And how do I create a dynamic mesh? Whatever I chose with the CreateMesh() command seems to be overwritten by the FinishMesh() command which converts it to either a Static(#True) or Dynamic(#False). So what´s the point of having that option with the CreateMesh() command?
Also whenever I use FinishMesh(#False) my application doesn´t display the created mesh at all and when I close the application it just crashes instead of just exiting. This tells me that there are differences in capabilities between Static and Dynamic meshes, but what?
So how should I best create and modify a mesh in realtime? I want to be able to change vertexcoordinates, normals, UVs, adding/removing vertices and triangles. Basically everything.
Another issue is how I get the specific vertex or triangle I want to change. All the commands seems to loop through from the beginning and this is a problem if I want to have each vertex and triangle set as an indexnumber.
Imagine I create a 3D tool like Lightwave and 3DStudioMax. I need to control the mesh completely. Selecting a vertex or triangle and changing all values on that.
How would I accomplish that?
//Andreas..