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 Miziziziz · Sep 30, 2013 at 02:49 AM · collideroverlapsphere

how to make physics.OverlapSphere check multiple colliders?

I want a way so physics.overlapsphere will check overlap on multiple colliders without making duplicates.

Example: object A is the parent of two colliders. When button 'X' is pressed, a message is sent to each object that may be inside the colliders. also, these two colliders overlap, so an object might be in both colliders at the same time, however the object will only receive the message once. How would this be done?

Comment
Add comment · Show 8
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 robertbu · Sep 30, 2013 at 05:07 AM 0
Share

It is hard for me to puzzle out what you are trying to do here. I don't know what the sphere represents or where OverlapSphere() is being called. Note that OverlapSphere() returns a list of colliders, not just a single collider. As a word of caution, OverlapSphere checks against the bounding box of the collider, not against the collider itself.

avatar image reefwirrax · Sep 30, 2013 at 05:37 AM 0
Share

you want to check all the Colliders in a specific radius, and if there are 2 legs that are on the same parent object, only return the collision information for one parent object.

avatar image reefwirrax · Sep 30, 2013 at 07:33 AM 0
Share

I think you can loop through all the detected objects and find each parent object and put it in a generic list, and then run a command to delete duplicates on the generic list.

If this is helpful vote me up because I don't have enough points to rate questions

avatar image Miziziziz · Sep 30, 2013 at 02:37 PM 0
Share

I'll try to be more specific: physics.overlapsphere is the only way I know how to perform a "Send$$anonymous$$essage" to all colliders inside another collider.

what I'm trying to do is do a "Send$$anonymous$$essage" to all colliders inside multiple colliders. does that make sense?

for example, there is a fire spread out over a large area, this fire requires multiple trigger colliders to cover its area.

If the player enters the collider for one part of the fire, he begins taking damage (Send$$anonymous$$essage, "Apply Damage", etc.). The thing is, some of the colliders overlap, and I don't want the player taking double damage when standing in those parts.

avatar image Jamora · Sep 30, 2013 at 02:54 PM 0
Share

You might find these callbacks interesting in the $$anonymous$$onoBehaviour class:

  • OnCollisionEnter / OnTriggerEnter

  • OnCollisionExit / OnTriggerExit

  • OnCollisionStay / OnTriggerStay

Show more comments

1 Reply

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

Answer by jmatthews · Oct 09, 2013 at 01:24 PM

The easiest fix for this is to maintain a state in your player that tracks whether he's received flame damage this round or not. This will insure you have the outcome you're looking for and eliminate a bunch of edge cases you'll run into further down the road. In general I've always found that each object should control its own outcomes. It makes reasoning about your systems much easier.

Comment
Add comment · 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

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

17 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

Related Questions

OverlapSphere not detecting target 1 Answer

Overlapsphere crashing my game? 1 Answer

Want to spawn a box on other box but don't want those boxes to have same tag on each other using tag 0 Answers

Trying to check area for game objects that collide with spawnpoints, then spawn an item where ever there is not a collision 0 Answers

Overlapsphere not returning all colliders it touches 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