Search Unity

Question Unity Asset Store: Where may I get 2D semi-circle?

Discussion in 'Editor & General Support' started by Unity-Student0, Dec 30, 2022.

  1. Unity-Student0

    Unity-Student0

    Joined:
    Aug 10, 2020
    Posts:
    263
    Hello,

    I want to create a semi-circle and put a collider. I made a quick check on the internet and these links don't say that it's possible. Whilst the internet mentions I can modify a circle collider, the more important point is the 2D semi-circle which I can't find. See the links I provided.

    https://forum.unity.com/threads/2d-spawning-in-half-circle.355847/
    https://www.reddit.com/r/Unity2D/comments/ikx5gq/how_to_create_a_semi_circle_object/

    I have been using Unity inconsistently and following tutorials for many years and I don't think I can keep following. I wish to be more independent by trying to create my own games to improve my personal understanding. I have made a quick check and Unreal, which is another game engine doesn't offer free items in the asset store unless the games are too old and no longer used. I have created 2D pictures in the past but they can't be used as the pictures will have white background whereas what I want is just a "U" shaped object. Nothing more. Is there a way for me to achieve this? Excuse me if there are asset stores that provides what I'm searching for but a quick check doesn't say this, at least not free ones.
     
    Last edited: Dec 30, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,736
    Here's a simple method to procedurally make a 2D circle:

    https://github.com/kurtdekker/makegeo/blob/master/makegeo/Assets/makeuvcircle/MakeUVCircle.cs

    Screen Shot 2022-12-30 at 7.55.43 AM.png

    To make the above return a semicircle just divide
    angle
    by two at around line 75 above.

    To rotate around the clock face where the semicircle is, add an offset (in radians) to angle AFTER you divide it by 2.

    Code (csharp):
    1. angle /= 2; // make it a semicircle instead
    2. angle += Mathf.PI; // make the curved part be low
    NOTE: angle is in radians, NOT degrees.

    Screen Shot 2022-12-30 at 7.55.55 AM.png

    Full demo scene as well as other examples can be found in the above project.
     
  3. Unity-Student0

    Unity-Student0

    Joined:
    Aug 10, 2020
    Posts:
    263
    I can't open this in 2021.3.16 LTS. Are you the author of this? Can you update to 5.6.6f2?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,736
    You don't even need the whole project, just take the single file of source code above and call the Create() method with the given arguments.

    Here is how to use it:

    Code (csharp):
    1. // make the circle
    2. GameObject go = MakeUVCircle.Create (Vector3.one, AxisDirection.ZMINUS, 10);
    3.  
    4. // add a visible material
    5. go.GetComponent<MeshRenderer> ().material = PutYourMaterialReferenceHere;
     
  5. Unity-Student0

    Unity-Student0

    Joined:
    Aug 10, 2020
    Posts:
    263
    Goodness. I need step by step tutorial here. I got no idea what I'm doing. Can you a complete example for me to study? Excuse me if I sound stupid.
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,736
    Use Step #2 below... luckily you don't even need Step #1 because you can copy/paste the code.

    Tutorials and example code are great, but keep this in mind to maximize your success and minimize your frustration:

    How to do tutorials properly, two (2) simple steps to success:

    Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That's how software engineering works. Every step must be taken, every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly, literally NOTHING can be omitted or skipped.

    Fortunately this is the easiest part to get right: Be a robot. Don't make any mistakes.
    BE PERFECT IN EVERYTHING YOU DO HERE!!

    If you get any errors, learn how to read the error code and fix your error. Google is your friend here. Do NOT continue until you fix your error. Your error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

    Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

    Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. If you want to learn, you MUST do Step 2.


    Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there's an error, you will NEVER be the first guy to find it.

    Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!
     
  7. faizpatel81528

    faizpatel81528

    Joined:
    Dec 10, 2022
    Posts:
    14
    Try using Blender
     
  8. Unity-Student0

    Unity-Student0

    Joined:
    Aug 10, 2020
    Posts:
    263
    This thread is solved. I succeeded getting it done using another tutorial.