• 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
Question by Khalanar_Dev · Dec 22, 2013 at 05:11 PM · collisioncollidertriggerraycasting

Collision detection accuracy issues.

Hello!

I am currently developing a 2.5D horizontal scroll platformer in StrangeLight Games. We have been using Unity for a while now and we have experienced some issues regarding trigger and collider detection not being as accurate as we needed. Until now these were not really important but we've come to a tougher situation recently.

In the caption below you can see in high poly, bumpmapped, with realtime shadows (just kidding, used some primitives :P) our configuration. Our character is the capsule object and the cube our enemy. When our player touches the enemy from above, the enemy dies, deactivating all of its colliders. We deactivate them in order to avoid the player from colliding with the bottom collider, which kills him.

alt text

Well, theory is simple but, In most cases our player dies and kills the enemy. That means there are few frames when our box enemy is dead, and alive at the same time, very Schrödinger cat's like. The player should have deactivated its colliders but this takes some time, so our player manages to get through and touch the bottom collider before it has been deactivated.

Our player is using:

  • Rigidbody in parent object, no Gravity and is Kinematic

  • Character Controller

Our enemy is using :

  • Rigidbody in parent object, no Gravity and is Kinematic

  • Top and bottom Colliders in children, set to triggers

We have been tweaking around with the Collision Detection and Gravity in our Character, but it still happens.

Should we be using Raycasting to check distance between our character and our enemy in order to deactivate colliders? Is there some other adjustment we can play with to obtain more accurate collision detection?

captura de pantalla 2013-12-22 a la(s) 17.15.11.png (79.9 kB)
Comment

People who like this

0 Show 1
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 KellyThomas · Dec 22, 2013 at 05:17 PM 0
Share

Which comes first the chicken or the egg? Which trigger goes of first?

Can you set a boolean flag to control the behavior of the code in the other?

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Khalanar_Dev · Dec 23, 2013 at 10:29 AM

Triggers are detected in the correct order. Top one jumps first and bottom one after that. They go of in the correct order but with some delay, not big but big enough to make the player enter both triggers before the first one has time to deactivate the second. May it be a problem with Fixed Timestep or maximum time allowed?

Thank you =)

Comment

People who like this

0 Show 0 · 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.

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

19 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

Related Questions

Why does this script check for raycast collision? Is it necessary? 1 Answer

Collision returning an error 0 Answers

Detect a collision point, but allow pass through collider. 0 Answers

Detecting another object collision from another object script (2D) 0 Answers

2D Platformer - Picking Up Items & Storing Them C# 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