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
1
Question by CurryBento · Jan 06, 2015 at 10:49 PM · collisionstuck

Object moves out of own collider.

Hey there Unity Community.

Running into a snag, a picture says a thousand words so: alt text

As you can see, the object is lower than it's collider. This ball frequently drops in the game I'm making. I'm using a raycast to detect the ground beneath it to bring it to a halt. The object should become kinematic when the raycast hits, then become non-kinematic after it stops detecting any surface below it (the ground rotates away). Once the ball starts moving the collider seems to update to the position the ball is in. Since the ball tends to clip through the floor it's getting stuck.

alt text

Does anyone know what could be causing this? Thanks in advance.

ihateyouball.jpg (62.7 kB)
ihateyousomuch.jpg (36.9 kB)
Comment
Add comment · 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 Mikenseer · Jan 06, 2015 at 11:30 PM 0
Share

Is the collider lagging behind only during motion? I assume so based on second screenshot.

Also the real reason I commented: Love the .jpg file names.

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by CurryBento · Jan 08, 2015 at 11:30 AM

Took me a while to get it right, but I've solved the issue.

Had a bool which would set to true while a coroutine was running. If the bool was true I made the ball object kinematic. Once it sets to false it becomes non-kinematic and velocity is applied to the Y axis. Then, if a raycast hits the level collider, the velocity of the ball is set to zero, stopping it from going through the mesh collider of the level.

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 Limesta · Jan 06, 2015 at 11:54 PM

Be sure to check whether or not you are changing the spherical colliders Y position, this may cause issues, but if that is not the case, try this code after you change the isKinematic property:

 SphereCollider.center = Vector3.zero;

This will reset the collider to the center of the ball

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 Owen-Reynolds · Jan 07, 2015 at 05:46 AM

That's not normally going to happen. You have to specially set things up to even make this possible (model and collider drift apart.) You probably did that by mistake. Do you have the ball and collider on different children, both moving? Two rigidbodies? As Limesta notes, changing the collider center would do it, but I think you'd know if you were doing that.

Also, pause the game and find out just what is moving. Keep trying to recenter the ball (or collider?) until you find out exactly what was set funny.

And, then, view from all around. The collider may always be wrong, but just looks correct from certain angles.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Rigidbody stuck in colliders when moving and ricosheting. 0 Answers

Smooth Mouse Script Problems 0 Answers

Why is my object getting stuck in the edge of other objects? 2 Answers

how to go through platform like bananakong? 1 Answer

Colliders getting stuck on and trespassing mesh 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