• 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 giantkilleroverunity3d · Aug 13, 2019 at 06:00 AM · colliderscollision detection

How do I negotiate collisions between two colliders?

I have two collider gameobjects each driven by a player. When the two objects collide I want to keep score of each, like bumper cars. Naturally only one can register a hit in the current collision detect. But the counter quickly gets out of hand or the counts are off, like noisy or switch bounce. I am using OnCollisionEnter. I am even using velocity compares but this isnt working correctly either. I have not found any collision hierarchy logic or collision predominance logic to implement. It all starts with two active colliders. When they meet the code executes for both and they both win a point. But I am aiming for only one to win the collision point. Thank you in advance.

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 dididucdich · Aug 13, 2019 at 07:37 AM

There are some conditions when a player gets a point and the other not, I think? These conditions you have to implement for example in the OnCollisionEnter function, because Unity doesnt know the rules of your game.

Comment
Add comment · Show 5 · 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 giantkilleroverunity3d · Aug 13, 2019 at 03:26 PM 0
Share

Yes. But there has to be a way to negotiate, prioritize, arbitrate, and mediate. When two colliders hit there is a cacophony of events. Oh and because velocity and thrust are still on too. Each shows an impact. And because the code sits in two onCollisionsEnter, one for each object it is attached to? I have to assess a hierarchy of design parameters. So I must catch the first one then ignore all the rest and that would be in a time frame, acceptance window or till some other event? Hmmm. I see what you are saying and this has caused me to slice this problem to a greater degree of granularity. I must dissect and pursue this dilemma further. I must be missing part of the total situation then. I should have delved into this sooner before my project became larger. This is one of those 'Walk aways' where I must extract myself from the problem to see a clearing. This is definitely all 'Bumped up'. I am open to any more suggestions. Or how anybody has solved this because this is definitely a multiplayer concern.

avatar image giantkilleroverunity3d · Aug 13, 2019 at 03:40 PM 0
Share

Well now. I had an epiphany and went into the realm of '$$anonymous$$ultiplayer collision management'. O$$anonymous$$G what an open pit of decisions and assessments one has to make. I thought is was an easy task of just adding a collision detection to a gameobject. This merely opens up the bottomless pit of agony. I must now dig further in and attain new levels of knowledge to circumvent my current apoplexy. Wish me luck. It looks like its going to get ugly. The sirens of the dark abyss are calling out and seducing me into the void.

avatar image giantkilleroverunity3d · Aug 13, 2019 at 03:43 PM 0
Share

It all boils down to arbitration hierarchy...

avatar image Bonfire-Boy · Aug 13, 2019 at 05:19 PM 0
Share

But there has to be a way to negotiate, prioritize, arbitrate, and mediate.

I don't see why that "has to be" something that you can implement in a way other than via adding your own logic to make the decision. I wouldn't expect that.

avatar image giantkilleroverunity3d Bonfire-Boy · Aug 13, 2019 at 05:57 PM 0
Share

I totally agree with you on this. I am also looking at this from a perspective of using Bolt graphical design too. After adding detection collision to a project is when the real design comes to play. In my one piece of collision detection handler code I went down the path of identifying what triggered the collision. Was it player 1 or player 2. Well that doesn't work as the first tag is always first because both colliders see the collision. Also this is not a networked situation yet. A player can a be human and the other is AI or vice versa. $$anonymous$$y thinking now is the same piece of code with two public gameobjects in the inspector. I then assign the two GOs in one order for player one then in player two I reverse the assignments. That way I can use the instantiation to start the control logic. But this could be the long way around the park also.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

Bullet/Projectile Collision Question 2 Answers

Audio trigger when FPS walks into things, walls, doors etc 0 Answers

Detect if a non-trigger collider is inside another collider 1 Answer

Best method to make the main character traverse multiple layers of objects using Unity 2D 1 Answer

Translating an object along a line until it collides with other objects 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