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
3
Question by steinbitglis · Dec 12, 2011 at 04:29 PM · physicsrigidbodyboxcolliderontriggerexitiskinematic

Why do I get OnTriggerExit upon collision when a rigidbody is kinematic? (example)

Hi!

I have organized my game in scenes that deactivate when the player leave them (static trigger colliders), and for this I use OnTriggerExit(). Sadly, I also need to occasionally set the player (which is a Rigidbody with a BoxCollider) to kinematic in order to do an animated ledgegrab. During the time that the player is kinematic, the scene occasionally receive an OnTriggerExit() call if something collides with the player. I̶t̶ ̶d̶o̶e̶s̶n̶'̶t̶ ̶h̶a̶p̶p̶e̶n̶ ̶e̶v̶e̶r̶y̶ ̶t̶i̶m̶e̶,̶ ̶b̶u̶t̶ ̶w̶i̶t̶h̶ ̶s̶o̶m̶e̶ ̶k̶i̶n̶d̶ ̶o̶f̶ ̶p̶r̶o̶b̶a̶b̶i̶l̶i̶t̶y̶.

Edit:

I created a minimalistic example.unitypackage. In the example the game will pause when the boxes collide, which is caused by my problem: the OnTriggerExit() being called (the example is deterministic).

Comment
Add comment · Show 10
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 steinbitglis · Feb 14, 2012 at 07:44 PM 0
Share

I doesn't seem like anybody knows the reason, but maybe someone can test to see if it's still an issue in 3.5?

avatar image steinbitglis · Feb 21, 2012 at 03:04 AM 0
Share

This bug is still present in 3.5 :-(

avatar image CapnCromulent · Aug 22, 2012 at 01:39 AM 1
Share

Did you ever resolve this issue? I think I'm seeing the same problem in 3.5.3: an enemy with a kinematic rigidbody and multiple colliders gets hit by a bullet, which sometimes calls OnTriggerExit even though the collider is clearly inside the trigger. In my case, I see the problem in iOS, but not in the editor.

avatar image steinbitglis · Aug 22, 2012 at 08:16 AM 0
Share

I haven't checked since 3.5.0, but I've made a lot of workarounds. $$anonymous$$y guess is that the bug is still there. When I found it I had to experiment a bit before I found some positions that would provoke the bug, but it was not very hard to find.

avatar image Vandash · Feb 23, 2013 at 03:02 PM 1
Share

Just texted in 4.x and this bug is still here. It was reported.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Statement · Dec 13, 2011 at 12:54 PM

I ran it, and it's mildly disturbing to say the least... If it is of any help, I changed the Collision Detection of the falling cube to Continous. After I did this, OnTriggerExit no longer fire on collision. Try if it would help your project. Why it would register as outside the trigger in the first place, I have no clue.

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 steinbitglis · Dec 14, 2011 at 10:44 PM 0
Share

I agree that it's a bit disturbing. I'm not sure if the continuous mode worked is by chance or not. $$anonymous$$oving stuff around arbitrarily changes the result. For example changing the material fixes the example, but I hardly believe that it's a reliable fix. I'm going to test that tomorrow.

avatar image steinbitglis · Jan 10, 2012 at 10:13 AM 0
Share

Using Continuous does not solve the problem, but it makes it less likely. This is a serious problem for us, and I think we have to abandon this way of using triggers.

avatar image
1

Answer by steinbitglis · Sep 05, 2013 at 08:51 AM

I got this answer from Anthony (Unity QA):

We see that this bug is no longer reproducible with PhysX 3.3 we are working on now.

We are planning to switch to PhysX 3.3 in the future and then this bug would be gone.

Edit:

The bug is still there in 4.3

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
avatar image
-1

Answer by seedoubleyou · Dec 13, 2011 at 01:03 AM

Hard to tell from just your description, but obviously something is exiting your object's collider. You could try allowing the OnTriggerExit code to react only if an object with specific tags exit the collider.

For example:

 function OnTriggerExit(col : Collider) {
        if(col.gameObject.tag == "Enemy"){
       //do something
    }
 }
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 steinbitglis · Dec 13, 2011 at 12:30 PM 0
Share

It's not obvious, because I can't find anything exiting the collider. Take a look at my recent example package.

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem with MeshColliders and Rigidbodies 1 Answer

How to re-center a Rigidbody isKinematic object after adding force to it? 2 Answers

Activate physics when animation ends 0 Answers

Wheel Collider - Mesh/Box Collider Problem 0 Answers

Adding real life physics behavior on 3-d object. 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