Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by mnewt86 · Apr 29, 2016 at 07:40 AM · collision detectioncharacter controller

Objects move a fraction of the way through controller collider every time

Hello. I'm relatively new to Unity and very new to these forums. Advanced apologies for any trouble or headache this newness causes.

I have a simple script attached to a cube with a rigidbody, trigger and box collider that sucks the cube toward the player using AddForce when the player is inside the trigger and presses a key:

       if(Input.GetButton("Pull")) {
             rigidbody.AddForce(direction * 30);
             Debug.Log("Pull");
         }

The script works great, but when the cube collides with the player the block stops hard as if it's hitting the collider, except 1/5 of the way through the collider instead of on the edge. This causes the block to spaz out and push away from the character once the character moves forward. The collider works fine if the player moves to the block, but not the other way around. The player and the block both have rigidbodies. The player's rigidbody is kinematic. I've tried ignoring physics layers. I've tried changing "max penetration for penalty" to a low number. I've tested in both Update and FixedUpdate. I've tried altering the skin width on the character controller. I've tried using different combinations of "continuous" and "continuous dynamic" collision detection. It strangely doesn't appear to be a problem with velocity, since it even happens when the block is traveling extremely slow. Even if I change the size of the collider, it's always exactly the same. The block always stops 1/5 in.

Additionally, when this happens, if the player is occupying both the cube's trigger as well as the trigger from another object, both triggers will behave as though they are one single trigger. In other words, even if I exit the other object's trigger, the functionality of that trigger doesn't seize until I exit both that trigger as well as the cube's trigger. This trigger confusion only happens when the player pulls the cube in to the 1/5 collider overlap.

Upon further investigation, i've found this happens with any moving object, whether pulled by the AddForce script or not. So I can't be sure, but I don't believe it has anything to do with the script. It seems to me that, in my amateur status, there is some basic functionality of character controller colliders that I am not understanding.

I tweaked the script to determine the distance between the block and the player and to stop before the block penetrates the collider, but that's more attacking the symptoms rather than the cause, and doesn't quite work with the gameplay I'm going for.

I'm running Unity 4.6.3

Any help or insight would be greatly appreciated.

EDIT: TLDR version: Objects moving toward a character controller collider pass through the collider and make contact at an invisible point inside the collider, but a character controller collider that runs into static objects stops right at the collider bounds. Can someone explain this to me? It seems I need to wrap my head around passive vs active collision detection, but I'm having some trouble understanding what is happening here and I can't seem to find what I'm looking for in the documentation or forums. Thank you.

alt text

pleasehelp.png (143.3 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.

Follow this Question

Answers Answers and Comments

55 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

Related Questions

Character controller walk over other moving collider 0 Answers

Character moves up from plane due to character controller radius and hight. 0 Answers

character feet go slightly beneath floor in certain situations 0 Answers

Trouble with collison and trigger's 1 Answer

Help with getting my player to stop moving when they hit a wall? 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