Unity-UI-Polygon | Polygon renderer for the new Unity UI | Graphics library
kandi X-RAY | Unity-UI-Polygon Summary
kandi X-RAY | Unity-UI-Polygon Summary
Polygon renderer for the new Unity UI
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Unity-UI-Polygon
Unity-UI-Polygon Key Features
Unity-UI-Polygon Examples and Code Snippets
Community Discussions
Trending Discussions on Unity-UI-Polygon
QUESTION
At the moment I generate the meshes (3,4,5 vertices) for myself, I look for the vertices and generate the meshes.
My problem is that I want to generate meshes like this: https://en.wikipedia.org/wiki/Hexadecagon (and below: 15,14,13.. vertices) and I dont want to do this per hand. Is there a way or a trick, how I can do this with code? I used this: https://github.com/CiaccoDavide/Unity-UI-Polygon but I can not add colliders and get the actual mesh which is generated there.
...ANSWER
Answered 2019-Feb-11 at 18:48You want to fit your points onto a unit circle, and then scale if desired.
Given a number of vertices >= 3, the angle between each vertex is 360/(number of vertices)
e.g., for 5 vertices, each vertex must be 72 degrees apart.
Now, with a starting angle of 0 degrees, for each vertex, your x-coordinate is the cosine of your starting angle, and your y-coordinate is the sine of your starting angle. After each vertex, increment your starting angle by the above-calculated angle.
Here's some Matlab code which demonstrates what I'm saying for a polygon containing 13 vertices:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Unity-UI-Polygon
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page