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 mysterymilk · Dec 14, 2016 at 02:49 PM · 2d2d gamemobile

Creating a 2D partial ring which expands/contracts in angle and collides

I'm fairly new to Unity and this has me completely stumped.

What I'm looking to make is a ring-shaped "barrier" sprite for my 2D game which rotates around a single point. Over the course of the game, this barrier expands and contracts in angle. At some points, it will be a full 360-degree circle, but the angle of the barrier steadily degrades over time down to around 45 degrees.

In essence, I want to take the behaviour of a radial UI object and apply it to a physics object (check the image below).

alt text

The barrier is a main object in a very minimalistic game, therefore the transition in angle needs to look really smooth, as jagged expansion/contraction would end up being really noticeable and jarring.

I've tried to group together lots of small "slices" of ring which overlap each other initially then fan out to make a full 360-degree circle), however the images would always be very slightly misaligned on certain devices and break the effect of a smooth ring.

I've looked into simple masks, but can't figure out how to achieve the desired outcome. I also read about shaders in a slightly related thread but that stuff is way beyond me (but I'll learn more about them if that's the only solution out there).

What's more, it needs to have a 2D collider which accurately readjusts to the barrier's current shape every frame. If the barrier didn't have to constantly change in size, I would usually just make a polygon collider which would auto-fill the shape of the sprite, but now that the shape of the ring is changing every frame, I'm struggling to think of the most performant way to accomplish this.

I would be hugely grateful If anyone can point me in the right direction, even if it's a vague "learn more about X".

screen-shot-2016-12-14-at-092236.png (49.1 kB)
Comment
Add comment
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

1 Reply

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

Answer by Landern · Dec 14, 2016 at 02:50 PM

@Eric5h5 posted about this a while ago with an example, it uses a gradient mask for the circle and works quite nicely. You can find the UA post here: http://answers.unity3d.com/questions/14770/creating-a-circular-progressbar-timer.html

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 mysterymilk · Dec 14, 2016 at 08:26 PM 0
Share

This is perfect!

Thanks for taking the time to help me out, @Landern :)

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

Problem with Vector3 Distance and Mouse Input, 1 Answer

Making the enemy follow the path of the Player,How to make the enemy follow the path of the player? 0 Answers

Can I use the Sprite Mode Polygon Editor to outline multiple sprites in one image atlas? Ifso, howso? 0 Answers

In my 2D platformer game, how would I create a height marker?, 1 Answer

How to stop crouching automaticaly after getting out of a small area 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