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 /
  • Help Room /
avatar image
0
Question by iferoporefi · Oct 31, 2015 at 10:18 AM · collision detectiononcollisionexit

Who calls OnCollisionExit?

Hi everyone,

I'm working with motion controllers and I want to develop the Rubber Band Method for my thesis to backtrack my hand (not crossing) when colliding with walls.

I have a Sphere collidere for each finger and the rigidbody on the root gameobject. At first I developed a script for each collider but it wont be called because the rigidbody is on the root transform. After a while I tried to use a single script while saving all the ID of the colliders and for the OnCollisionEnter and OnCollisionStay I can understand which collider called the event (because I check the istanceID from the colliders of the contact point) BUT with che OnCollisionExit I do not have any contact point, so I cannot understand which of my colliders called the OnCollisionExit.

any help will be appreciated.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by hexagonius · Oct 31, 2015 at 10:36 AM

OnCollisionExit provides the same information as OnCollisionEnter does. I just checked with code I wrote a while ago that checks contactpoints in OnCollisionExit and it worked.

Comment
Add comment · Show 1 · 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 iferoporefi · Oct 31, 2015 at 10:46 AM 0
Share

@hexagonius my Debug.Log(hit.contacts.Length); return a zero. is it weird so?

avatar image
0

Answer by iferoporefi · Oct 31, 2015 at 01:18 PM

http://answers.unity3d.com/questions/914908/u5-no-contactpoints-in-oncollisionexit.html

from this answer it seems like that there is no chance to get those contact points.

@hexagonius : If your old script is from unity 4.6 then you are right. It seems like that from unity 5 the OnCollisionExit does not return any contact point.

Comment
Add comment · Show 2 · 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 hexagonius · Oct 31, 2015 at 02:11 PM 0
Share

Thanks for pointing that out. They should really stop messing with working stuff all the time... maybe tracking colliders on enter and keep comparing in stay while checking in FixedUpdate if stay was called last time (is not if no more colliders) might give a solid opportunity to fire your own exit.

avatar image iferoporefi hexagonius · Oct 31, 2015 at 02:37 PM 0
Share

@hexagonius I've tried before but the problem is that I have multiple colliders and sometimes the OnCollisionStay does not give me back the one that I really need

It would be great if they fix this issue because it would be very useful

avatar image
0

Answer by Brandon529 · Apr 20, 2018 at 05:50 PM

i just posted an answer to all your guys' problems on the link @iferoporefi shared, even tho im 3 years late.

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

33 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

Related Questions

OnCollisionEnter Problem 1 Answer

How do I make a pressure plate register when the player is on top of it, and when a player gets off of it? 0 Answers

ECS performent collision 0 Answers

Detecting missing collision in 2D platformer to change direction for enemy - without Raycast 1 Answer

How to make Objects moving on a circular path collide with each other? 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