Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CharacterController reported wrong hit using OnControllerColliderHit

Discussion in 'Physics' started by bawenang, Mar 22, 2017.

  1. bawenang

    bawenang

    Joined:
    Aug 18, 2012
    Posts:
    119
    Hi, I've made the same thread on Answer but it didn't get any answer. So I tried to put it again here since I need to solve this ASAP.

    I'm trying to use the CharacterController class for a simple runner game. And I found out that its collision is often wrong. Look at this screenshot, for example:



    FYI, the red sphere is the point of collision reported by the OnControllerColliderHit() callback (drawn from OnDrawGizmos()). While you can see that capsule is the CharacterControl object in question. There are tons of other weird and wrong collision behaviours sometimes. Like not detecting a collision with another object when it should be, or colliding of an object althought its still far away, etc.

    I didn't do anything out of the ordinary to the CharacterController's object. Just the usual calculate the final move vector of the object, time it by Time.deltaTime, use it as the parameter of CharacterController.Move()

    Can anybody tell me what's wrong with this? And how to fix it?

    Thanks
     
  2. bawenang

    bawenang

    Joined:
    Aug 18, 2012
    Posts:
    119
    *bump*

    Anyone? Or should I just use Rigidbody + Collider instead of CharacterController? But then again, how do I cap the maximum speed using Rigidbody?
     
    Last edited: Mar 23, 2017
  3. bawenang

    bawenang

    Joined:
    Aug 18, 2012
    Posts:
    119
    *bump*