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 marcosocram · Jul 19, 2018 at 10:38 PM · positionmathpositioningoverlapoverlapsphere

How to place an object near N number of objects in order to avoid overlap?

My users are set inside a sphere and I get a position from ray.hit in the surface of the spehre. Then I place an indicator, but sometimes they overlapp, weather the user do so or when I randomly place them.

How can I determine the ideal position near or among a given N number of indicators?

Comment
Add comment · Show 5
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 Captain_Pineapple · Jul 25, 2018 at 11:57 AM 0
Share

Hey there,

can you provide a bit more info on the problem? Perhaps a part of the code that you use?

i especially do not undestand what you want to say with "Then I place an indicator, but sometimes they overlapp, weather the user do so or when I randomly place them."

What is the goal? To place Indicators/markers on a sphere that do never touch? Please specify this for us.

avatar image marcosocram Captain_Pineapple · Jul 25, 2018 at 03:50 PM 0
Share

Hey Capitan, my problem is related to this question, but cant implement anything they recomend in my case: https://answers.unity.com/questions/1486937/math-place-object-without-overlap-others.html

The users place an indicator, a sprite, in the inside surface of a sphere. For doing that I ray cast from outside the sphere and then correct the position. I dont have code for that yet. I just wanted to know if there is a way to pack circles without overlaping them.

avatar image Captain_Pineapple marcosocram · Jul 27, 2018 at 08:33 AM 0
Share

Hm okay i think i understand what you are trying to do. Though unfortunatly that is quite difficult to do...

Could you perhaps save a vector for each marker that gives you the direction from the spheres center to each marker. Then you can at least check if a markers position is valid by comparing the vectors against each other. So when placing a new marker the angle between the vectors pointing to the markers from the spheres center has to be larger than 2*arctan(markerRadius/sphereradius).

Note though that this calculation is not completly exact since it it designed for markers on a flat surface. So given that your sphere is large enough compared to the markers you are trying to set on it this should give you are pretty good approximation.

Hope this helps

avatar image madks13 Captain_Pineapple · Jul 27, 2018 at 09:50 AM 0
Share

Umm, it's hard to understand what you want to achieve even with the link you provided. Can you explain the gameplay from player's viewpoint?

avatar image hexagonius · Jul 27, 2018 at 08:08 PM 0
Share

my solution would be to provide predefined slots the user can place stuff on. that's because all the automatic correction you're doing after a couple of them are placed won't let the user place them where he wants them anyway, so you could just go with that.

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

112 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

Related Questions

How to get a vector3 (postion) 1 unit away from another in the direction of a 3rd vector3? 2 Answers

How to make UI appear in camera scene view? 0 Answers

GUI position according to screen resolution 1 Answer

Object is not following the touch position 0 Answers

How to implement a system for "Road-Construction"? 1 Answer


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