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 Vajoiner · Jan 16, 2011 at 12:17 AM · collidersontriggerenter

overlapping colliders

how can i get a fast moving collider with trigger to only broadcast one onTriggerEnter if it has entered a space with overlapping colliders?

ive tried destroying itself, turning it inactive, using a counter... this all seems not to matter because as you enter a frame (an update), if the trigger now entered multiple colliders space in that frame (update), it will broadcast immediately to every object there at the same time instead of succession.

what am i overlooking?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by The_r0nin · Jan 16, 2011 at 02:54 PM

This is a SERIOUS hack way to do it... but maybe it'll jostle an even better idea out of you (and please let me know if you find a better way... I could use it myself!).

Create an empty gameobject to serve as a counter, and store a "collision number" in it, along with a "current number" (I'm using an integer). Cache this object in each of your colliding objects. Upon colliding, the object requests a collision number from the counter object. The counter object increments the current number and sends it and the original number. If the current number is more than one more than the original number, then that is the second (or greater) collision (and is ignored). I then increment my original number and set the current number as the last thing in the process (so that old collisions don't get acted upon... they shouldn't anyway, but...).

I have very few objects at the moment, so the overhead is not large (this might not work if you've got lots of colliders). Also, you should be able to do all of the decision-making on the counter object and just send a boolean response... I didn't implement it that way simply because I'm using it for a proof-of-concept and not actual production code.

Hope this helps (or sparks a better idea).

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

No one has followed this question yet.

Related Questions

How Does OnTriggerEnter() Work? 0 Answers

Can't call GetKey inside OnTriggerEnter? 2 Answers

OnTriggerEnter/Exit not working 1 Answer

When player enters triggerzone call function 2 Answers

Hello, How would one make a particlesystem activate triggers? (hopefully I worded that right) 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