- Home /
Triangulated plane
Hello all,
I am making a game which you can use your mouse to click on human body and get some deformation on the body. Thus I need to get the trangulated meshes of the body and change the position of the triangles when I click on human body. Is there a way to get the axis of those triangulated planes?
Thanks, Kuo
I recommend you study the reference page for the $$anonymous$$esh class:
http://docs.unity3d.com/ScriptReference/$$anonymous$$esh.html
In Unity, vertices are separate from triangles. For what you are doing, you want to modify the vertices. The modification is easy, but identifying the right vertices can be difficult. A raycast (which you would do to project the mouse click into the scene) will identify the triangle hit which allows you to identify the three vertices of the hit triangle, but you will likely want to identify more vertices.
get the axis of those triangulated planes
I have no idea what this means.
Thank for your reply. "axis" is the vertices of the triangle. I used the second example and it works well for a cube, but when I attached to the human model, it doesn't seem to work at all. I guess I will have to use skin mesh. What is the difference between a skin mesh and a mesh?
Thanks.
Answer by AlwaysSunny · Aug 29, 2014 at 06:35 AM
As suggested by @robertbu, the Mesh class has what you need.
I'm guessing "get the axis" means the normal of the triangle hit by a raycast, which is found using hit.normal
As for getting nearby verts, probably with some kind of falloff - it's possible to loop through all verts and weight their deformation by proximity to the hit.point, though depending on the number of verts, it's likely to be quite expensive.
If "get the axis" means the normal, then use the normals array in the $$anonymous$$esh. The is one entry in the normals array for each vertex in the vertices array.
Thanks for your answer. The 3d model I imported was using skinned mesh renderer,so when I used the example from the tutorial, it was changing anything. I am not worried about how it deforms now, because I cannot even change the shape at all. Should I use the function from skin mesh renderer?
Your answer
Follow this Question
Related Questions
Character Body Part Dismemberment 1 Answer
Mask Transform options greyed out in Animation import settings -1 Answers
detach body parts 0 Answers
AR foundation release schedule for body and face detection on Android? 0 Answers
Freezing Rigidbody Rotation 1 Answer