• 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 TomYeti · Jun 14, 2016 at 06:16 PM · collision detection

Why is this Physics.Overlap triggering?

I'm running into an issue which appears to be a CharacterController incorrectly triggering a Physics.Overlap on another object when it is instantiated

Here is my code, stopped by the debugger. I added comments to show the values at the stopped moment

alt text

And here is the collider in question, as it appears in the debugger

alt text

It would seem that these colliders do not in fact overlap. The radius of 1.32 for the CharacterController should not put it within reach of the 5 unit radius of the Physics.Overlap. The world scale of the collider is 2.5, putting it at 3.3 radius max. Seeing as how the objects are 15.8 units apart, there's no way a 3.3 radius collider overlaps with a 5 radius OverlapSphere.

I should note that the commented out code near the top of the foreach fixes this problem. If I use that if statement to make the CollectFood function call only happen after being alive for .5 seconds, the function won't trigger. Any frame after the frame in which the collider is instantiated results in the colliders not touching, but with the same positions. It only triggers incorrectly on the frame it is created. The code that is instantiating the collider and it's gameobjects set the position on the very next line. There are no other function calls inbetween the Instantiate and me modifying the position.

I'd still like the collision detection to work without additional calculations and GetComponent calls to figure out it's age.

So why is the CharacterController overlapping on the frame it is created?

screen-shot-2016-06-13-at-124107-pm.png (69.7 kB)
screen-shot-2016-06-13-at-124310-pm.png (106.8 kB)
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

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Drag Rigidbody that respects collisions. 1 Answer

How can I change the Unity 5 UI hitbox/collider to fit my complex image? 1 Answer

How the 3D object on target image collide with the 3D game object of UI? 0 Answers

I can't manage to detect my collisions 0 Answers

help to understand collision detection 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