Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 TobLoef · Apr 11, 2015 at 03:18 PM · 2dmeshcircle

Creating a smooth flat circle?

Hey there. I'm new to the Unity scene, but I've been programming for a while. I'm trying to create a simple test where you can click a 2D Circle. Super simple. However, when I try to make a flat circle to click, I run in to problems. I didn't want to use image sprites, so I initially used a flat cylinder seen from the top. It looked fine and I could use whatever collider I needed, but when I scaled it up I noticed that it seems to have a really low level of detail. See this screenshot for example:

alt text

I almost wouldn't call it round. I feel like I'm missing something really obvious here, but when i googled it, no solutions came up. So, what can I do to increase the polygon count? And is there a better way to create a simple 2D circle?

Thank you.

Comment
Add comment · Show 9
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 ozturkcompany · Apr 11, 2015 at 03:33 PM 0
Share

Please correct me. What do you want is a really smooth circle? Does it matter if it is a mesh or just a representation such as an image?

avatar image _Gkxd · Apr 11, 2015 at 03:35 PM 1
Share

$$anonymous$$ake a quad and texture it with an image of a circle. Change the material of the quad so that it supports transparency. If the background of the image is transparent, you'll see a circle.

Then change the collider on it to a CircleCollider2D.

avatar image Owen-Reynolds · Apr 11, 2015 at 04:23 PM 0
Share

_GLxd: The OP doesn't want to use "image sprites," which sounds like a fancy way to say they don't want to use a texture.

I'm assu$$anonymous$$g they will either say why textures won't work; or they just heard "image sprites" were bad from some random guy (making this a really boring Q.)

avatar image _Gkxd · Apr 11, 2015 at 06:22 PM 0
Share

Ah, I thought "image sprites" referred to a 2D sprite that Unity has, as opposed to a 3D quad with a texture.

avatar image shopguy · Apr 15, 2015 at 02:10 AM 1
Share

Based on all comments so far.. sounds like: 1. Use a large sprite as _Gkxd just said.. AND make sure "mipmaps" are enabled for that sprite (default in U5, wasn't in U4), that way it looks good when small as well.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by saschandroid · Apr 15, 2015 at 09:26 AM

Creates a 'circle'-mesh with radius 0.5 and variable number of circle points:

 public void MakeCircle(int numOfPoints)
 {
     float angleStep = 360.0f / (float)numOfPoints;
     List<Vector3> vertexList = new List<Vector3>();
     List<int> triangleList = new List<int>();
     Quaternion quaternion = Quaternion.Euler(0.0f, 0.0f, angleStep);
     // Make first triangle.
     vertexList.Add(new Vector3(0.0f, 0.0f, 0.0f));  // 1. Circle center.
     vertexList.Add(new Vector3(0.0f, 0.5f, 0.0f));  // 2. First vertex on circle outline (radius = 0.5f)
     vertexList.Add(quaternion * vertexList[1]);     // 3. First vertex on circle outline rotated by angle)
     // Add triangle indices.
     triangleList.Add(0);
     triangleList.Add(1);
     triangleList.Add(2);
     for (int i = 0; i < numOfPoints - 1; i++)
     {
         triangleList.Add(0);                      // Index of circle center.
         triangleList.Add(vertexList.Count - 1);
         triangleList.Add(vertexList.Count);
         vertexList.Add(quaternion * vertexList[vertexList.Count - 1]);
     }
     Mesh mesh = new Mesh();
     mesh.vertices = vertexList.ToArray();
     mesh.triangles = triangleList.ToArray();               
 }
Comment
Add comment · Show 1 · 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
avatar image TobLoef · Apr 15, 2015 at 12:42 PM 0
Share

Wow, neat. I'm currently not able to test this, as I'm out traveling, but I'll try it when I get home. How is it for performance?

avatar image
1

Answer by Calum1015 · Apr 11, 2015 at 05:41 PM

You could get on a modelling program and do it yourself, honestly there's not much you can do other than sprites/textures and custom mesh's. You might be able to change the camera from Perspective mode to Orthographic then move it along the Y axis, but I don't know if that will change the quality, I mean you won't see all th lines if the cylinder is further away. Also, About the only way to make a 2d circle properly in Unity 2D is sprites.

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
avatar image
-2

Answer by pankrac2 · Apr 11, 2015 at 04:21 PM

Use sphere?

Comment
Add comment · Show 3 · 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
avatar image fafase · Apr 11, 2015 at 05:58 PM 0
Share

he needs a circle.

avatar image Bonfire-Boy · Apr 11, 2015 at 07:11 PM 0
Share

As things stand he's getting a circle by looking at a cylinder end on. If you're going to do that then I$$anonymous$$O using a sphere ins$$anonymous$$d makes a lot of sense.

avatar image Thewoxyz · Apr 11, 2015 at 07:29 PM 0
Share

Sphere won't be more detailed + you won't be using half the mesh of it (backside) and it will make some possibly unwanted shading

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

3d collider mesh to 2d collider mesh 0 Answers

Drawing new mesh not working 1 Answer

Any way to access SpriteRenderer mesh UV2? 0 Answers

I want do my own mesh "quad", but not square, I want a 2D polygon to apply in a parallax scroll 1 Answer

Collisions in Custom Physics Using Circlecast 0 Answers


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