|
hi guys i want to generate a simple mesh at runtime and then use it for my object's mesh renderer but i can not see anything on the screen. i think my problem is with setting triangles. is there anyone that he knows how should i set triangles and what are the different approaches for setting triangles vertecies? this is my code
(comments are locked)
|
|
This tutorial from the UniKnowledge contest covers creating meshes via scripting, including how to correctly set the triangles (see page 9 of the pdf in Tutorial.zip). Looks like his link is dead, is it available anywhere else?
Apr 20 '11 at 03:32 PM
davebuchhofer
I would also like to know if this tut on creating meshes is available anywhere.
Apr 26 '11 at 12:44 AM
sandworm
3rd...there needs to be more info about creating meshes by hand!
Apr 29 '11 at 12:39 AM
kablammyman
The author, FlamingHairball, has posted the tutorials here: http://dl.dropbox.com/u/680550/MeshTutorial.zip EDIT: Since the above link is dead, I've mirrored the PDF file here: http://games.deozaan.com/unity/MeshTutorial.pdf
Jan 22 '12 at 01:41 AM
Deozaan
(comments are locked)
|
|
Hey guys, Sorry for the late response. I've been swamped and am in the process of transitioning hosting, so my server is down. You can temporarily access the tutorial here: http://dl.dropbox.com/u/680550/MeshTutorial.zip It's an archive that contains the tutorial PDF and the required files. Sorry for the inconvenience! Best wishes, -Lincoln Green The file only contains PDFs, no the required files for part 2.
Apr 26 '12 at 08:41 AM
carlos3dx
(comments are locked)
|
|
I believe you need to fill in your array values first and then finish by assigning mesh.uvs, mesh.uvs, mesh.vertices, mesh.triangles, all at once as in the Mesh documentation examples - http://unity3d.com/support/documentation/ScriptReference/Mesh.html
(comments are locked)
|
|
But can you see the new mesh gets applied in the inspector to your transform? I never really created meshes at runtime but did you try using "m.RecalculateNormals();" instead? .Recalculatenormals(); is required only when you need your mesh to cooperate with lighting engine. It is not required but I would advise of use it for convience.
Apr 26 '12 at 09:10 AM
cupsster
(comments are locked)
|

Hey,
I'm looking for the correct method to generate the triangles from an array of vertices. The link above is dead. May someone make it available again?
Thanks
Here's a mirror of the PDF file from FlamingHairball's (Lincoln Green's) tutorial: http://games.deozaan.com/unity/MeshTutorial.pdf
@maveryck21: Don't post an answer when you don't want to answer the queestion. I've converted your answer into a comment.
There is no correct way to form triangles out of vertices, because it depends on what you actually want to create. You can create a triangle between any vertices in the vertices array.
Just look at the example in the docs. Phil has posted the link already in his answer below...
Also there are many questions like this already on UA. Just use the internal search function or even better google
Unity Tips and Tricks has a good tutorial on it.