• 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 barciu · Apr 01, 2017 at 08:08 AM · collisionphysicsrigidbodyrigidbody2dphysics2d

RigidBody becomes awake without a collision

I have a ball object with a RigidBody that is initially asleep and the ball is floating in the air. I want the ball to become awake when a player object touches it (which I thought was a default behaviour). Instead, the ball gets awaken if a player gets close to it, but still without touching it. How can I prevent this from happening? I checked the OnCollisionEnter() method and it's not called when the ball becomes awake. It gets called when an actual collision happens.

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
Best Answer

Answer by MelvMay · Apr 01, 2017 at 10:48 AM

OnCollisionEnter()

So you're talking about 3D physics then. In-case you're not using 3D physics, know that 2D physics wakes objects when their AABB overlap and not when they collide. Unity uses Box2D for 2D physics and this is fixed behaviour. You can visualise the AABB of colliders by going into 2D physic settings, opening "Gizmos" and checking Show Collider AABB property. When BoxCollider2D are not rotated, their AABB are perfectly aligned with the collider however if they rotate you'll see they are not. For other colliders, the AABB never aligns perfectly with the collider.
Comment
Add comment · Show 4 · 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 barciu · Apr 01, 2017 at 01:27 PM 0
Share

Thank you for a helpful answer. I turned on AABB gizmos, but they don't seem to overlap at the moment when the ball becomes awake. I'm attaching a screenshot. Perhaps objects become awake even sooner. I should probably try to make the ball float in some other way and then detect a collision to unlock it.

aabb

aabb.png (237.9 kB)
avatar image MelvMay ♦♦ barciu · Apr 01, 2017 at 02:03 PM 0
Share

I can assure you, 2D physics wakes objects when their AABB overlap or if you perform an action that modifies the body in any way.

The image doesn't help at all because there's no description on what it is supposed to show.

avatar image barciu MelvMay ♦♦ · Apr 02, 2017 at 09:40 AM 0
Share

The image shows a player (the red blob), a ball and their AABBs that were turned on in the 2D Physics settings. It's more or less the moment when the ball becomes awake. The blob jumped up from the ground that's below.

Show more comments

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

157 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 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

Collision sticking? 1 Answer

Rigidbody2D and non-trigger child colliders! 2 Answers

Can I rotate a hinge joint where the angle limits aren't working?,Can I rotate a hinge joint, to minimize its rotation when angle limits aren't working? 1 Answer

Adding force to a rigidbody opposite to the direction of a rotating weapon 0 Answers

Rigidbody rotate velocity 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