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 jnc1 · Feb 26, 2014 at 12:04 PM · 3drangecircle

How can I draw a circle around an object

Hello,

I've got a problem, I need to show a range of visibility by drawing a circle around an object, however, if an other object is in the range, behind this object shouldn't be visible, how can I process to "cut" the circle ?

For now, I don't have any code, I'm gathering the working process.

edit : because the inner circle is filled, I think that should be a bit harder to do that

Thanks for you ideas

Comment
Add comment · Show 1
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 jnc1 · Feb 27, 2014 at 09:39 AM 0
Share

Hello, I have more informations for you, I intend to load a texture of a round created by myself, now I need to know how I can create the "shadow" on this texture of the object that is hiding the vision, I think I can do it with Physics.Raycast, but in this way I will need to change every pixels, and that will be a gigantic loop (even double loop).

So maybe there's a better way.

Thanks.

1 Reply

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

Answer by whydoidoit · Feb 27, 2014 at 01:20 PM

Well I'd not make it a true circle - I'd cast outwards from the central point a number of rays of the maximum length of the radius of the circle. I would then use the length before the ray hit something to create a polygon between the edge points and the centre. If you used 32 rays it would probably look circular enough.

  • Cast 32 rays from the centre of the visibility circle with a maximum range of the visibility length

  • If the ray doesn't hit anything record the positing at the extent of the ray

  • If the ray intersects something then record the point of intersection

  • Create a new mesh (or update a mesh) setting the vertices of each triangle to be the centre of the area and each two adjacent points from the array of collisions.

Optionally have the mesh drawn with a renderer that uses depth so that the objects that where hit by the ray correctly appear in front of the parts of the circle which (due to inaccuracies in only casting 32 rays) overlap.

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 jnc1 · Feb 27, 2014 at 01:57 PM 0
Share

Thanks you, I have now a better idea of how I'm going to do this :)

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

21 People are following this question.

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

Related Questions

Using 2d image for dragging? 0 Answers

How to know if gameobject is in a circle in my canvas? 1 Answer

Drawing a Range Icon in 3D Space 0 Answers

How to limit Cannon shooting for certain range in unity 2d ? 0 Answers

Best practice for tiled 3D terrain 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