Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by alph1 · Mar 28, 2017 at 10:58 AM · 2dmeshtrianglesmeshfiltertriangulation

2d custom mesh triangulator problem

Hello i having some trouble with well known triangulator class.I implemented the triangulator class directly without an edit.My aim is to create a volumetric light depending on the direction but im having this issue relative with triangles appearently. alt text

Another view alt text i keep the positions of the red colored rays start&end locations and i put these locations as vertices in MESH FILTER component.

 public void buildSingleVolume()
     {
         
 
         Mesh _mesh = new Mesh ();
         _mesh.name = "VolumeMesh";
 
         for (int i = 0; i < _vert2d.Length; i++)
         {
             _vert3d [i] = new Vector3 (_vert2d[i].x,_vert2d[i].y,0);
         }
 
         Triangulator _tr = new Triangulator (_vert2d);
         int[] indices = _tr.Triangulate ();
     
 
         _mesh.vertices = _vert3d;
         _mesh.triangles =indices;
         _mesh.RecalculateNormals ();
         _mesh.RecalculateBounds ();
 
 
         GameObject _instance = Instantiate (volume, Vector2.zero,new Quaternion(0,0,0,0)) as GameObject;
         _instance.tag = "VolumeL";
         _instance.GetComponent<MeshFilter> ().mesh = _mesh;
     }

the mesh would show up with exact positions of red rays but it has many zig-zag or false structure.

display1.png (231.8 kB)
display2.png (230.7 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mikael-H · Mar 28, 2017 at 12:53 PM 0
Share

I have done triangulation of arbitrary 2d points in several projects but I don't know what you mean by "well known" triangulator. Could you elaborate? Which library are you using? I am sure I could help you if I had the correct info. I also do not undersand the red rays, are those your resulting mesh after triangulation?

avatar image alph1 Mikael-H · Mar 28, 2017 at 09:22 PM 0
Share

It's the triangulator from wiki.unity link:http://wiki.unity3d.com/index.php?title=Triangulator like you said those are resulting mesh i use those rays to show if im doing things right.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by alph1 · Apr 02, 2017 at 07:00 PM

Solved.I sorted the vertices of the mesh as clockwise and then i triangulated the vertices i sorted with this link:http://wiki.unity3d.com/index.php?title=Triangulator Triangulator script.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Mesh with Holes 0 Answers

Generating single triangle meshes at run-time 1 Answer

Generated Mesh Triangles not Being Made/Visible? 1 Answer

Why is my script constructed mesh rotating the wrong way 0 Answers

Save only visible part of mesh 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges