Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 lighting · Aug 07, 2013 at 12:58 PM · cameraradarsector

Sector scanning in Unity

Hi,

I'd like to ask you about good/best solution for solving a problem with sector scan as illustrated on picture: http://content.answcdn.com/main/content/img/McGrawHill/Aviation/f0570-03.gif

This is required for me to have all objects that are visible by camera to be for example marked. I'd like to have rectangle, e.g. rectangle target and mark all objects inside this target. In unity there is nothing like "SectorCast".

Do you have any idea for solution of this problem ?

Thanks.

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

3 Replies

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

Answer by robertbu · Aug 07, 2013 at 02:47 PM

To solve the problem you outline in your comment, you can use Viewport coordinates. Viewport coordinates go from (0,0) in the lower left to (1,1) in the upper right. You can convert point into world space using Camera.WorldToScreenPoint(). You would define your rectangle in terms of viewport coordinates and then test points to see if they are inside the rectangle. I'm not sure how strict you need your visibility test to be. If you are look to see if any part of an object is within the rectangle, you can test all the points on the Renderer.bounds.

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 lighting · Aug 07, 2013 at 02:49 PM 0
Share

Yes. This is the way to follow. Thank you for the idea.

avatar image
1

Answer by ________ · Aug 07, 2013 at 01:43 PM

This may not help as I don't really know what your want to do but you could try:

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnBecameVisible.html and http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnBecameInvisible.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 lighting · Aug 07, 2013 at 01:59 PM 0
Share

It's sth like this but I'd like to catch object not in the whole screen that is visible by camera but only part of it (rectangle in the middle of screen). Example - imagine that you cover camera with glass with rectangle painted in the middle of the glass and you want filter objects that camera sees trough this rectangle.

avatar image
1

Answer by TonyLi · Aug 07, 2013 at 02:34 PM

You could use Physics. Add colliders to your objects. Set up a collider that extends out from your camera. Use OnCollisionEnter/OnTriggerEnter and OnCollisionExit/OnTriggerExit to keep track of what objects are within the camera's collider.

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 lighting · Aug 07, 2013 at 02:44 PM 0
Share

That's very curious idea. I'm not sure if this is possible to create piramid-shape collider in Unity for this purpose but I'll try.

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

16 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

Related Questions

how to put a border around a camera 1 Answer

How to make camera position relative to a specific target. 1 Answer

Help with minimap 1 Answer

How to model objects only visible to one player in a radar in a mech simulation game? A Fog of war question. 0 Answers

Third Person Camera Help? 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