Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 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 /
  • Help Room /
avatar image
0
Question by Nicokam · Mar 11, 2021 at 04:11 PM · collisioncoroutinecollision detectionbillboardplacement

Trouble with detecting collision in the same frame to make smart labels

Hello everyone.

I am having a hard time making “smart labels” for my game so that the user can view the points of interest (POI) with ease.

I’m going to explain some things before getting to the problem:


Contextualization


Billboard

The point of interest is a gameObject with a Canvas with its Render Mode set to World Space. Its role is simply to display the image and name of the space below it. Basically it is a billboard that constantly looks at the camera. It is also a way in which the user can interact with the world, so I added a box collider to it, making it able to detect a ray-cast to then perform some action.


Bilboard Visual

Billboard Transform


Scenario

It consists of a 3D city and the camera is top down in its standard mode but it can be tilted up to 60 degrees for perspective immersion.


Smart Label Logic


What I did was to set a specific relevance to each point of interest. Then I created a prefab that is placed exactly in the position of the POI. They are responsible for calculating the collisions, that is why they contain a Mesh renderer (which is for visualization only. I choose this instead of Gizmos so I could see them work within the game tab), Rigidbody and Sphere collider to be able to compute the collisions.


Circle Visual

Circle Transform


When the game starts, I organize the list with the labels by relevance, so that it can be placed in order.

Now, when the user zooms in or out, I resize the Sphere’s and make them collide in order to see which POI’s need to be displayed. As the user zooms out, the sphere’s grow bigger and only the important one’s will show and vice versa.


The ideal situation

When zoom changes:

  1. Deactivate all the spheres Colliders

  2. Resize all spheres Colliders

  3. Activate the game objects that contain the spheres (the Colliders are disabled so that they wont collide!)

  4. Activate the game objects that contain the spheres ONE BY ONE in the order of the already sorted list

  5. If it collides, deactivate the current (It means it collided with one of higher relevance)

  6. If it doesn’t collide, activate it.


Problem


When physics is involved, it wont compute the collision until the next frame. So, if I add this to the update function, it would not get the collisions correctly due to the frame-rate. If I add it to a coroutine and add the sphere, tell it to wait to the next frame and so on, IT WORKS, but takes too long to complete, making it unusable.


I feel like i’ve tried everything… I tried changing to fixed update, using OnTriggerEnter and even Check-sphere. NONE of these have worked.


I really need a direction because I have run out of things to try.

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

0 Replies

· Add your reply
  • Sort: 

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

229 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 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 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 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 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 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 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 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 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 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 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

Compatible collision constraint methods 0 Answers

Stop objects from going through eachother? 0 Answers

Is there any good sample code for shooting a projectile and collision detection? 0 Answers

Detecting collision altho disabled on matrix. Help!! :'( 0 Answers

OnTriggerEnter not being called 2 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