ControllerColliderHit hit point is wrong?

Hi,

I’m getting something weird returned by the OnControllerColliderHit.

I have a character, with a big round CharacterController around him.

Then I have a ‘pole’. Basically a long cylinder with a CapsuleCollider on it, the same size as the cylinder .

When I drop my character onto the pole and check the collision point it seems to be in the wrong place.

Now I’m checking it via OnControlColliderHit in the script attached to the player. I’m grabbing the ControllerColliderHit from the event and showing it as a widget (That’s the yellow dot in the pictures).

I don’t understand why the impact point is not on the pole. It seems to be lying somewhere along the normal of the collision point instead. (The Normal here is the red line). But obviously the colliders are colliding properly because visually the player is being stopped at the right point.

What am I missing here? I’ve never had a problem with the collision point in any of the other collision checking I’ve been doing.

Can you post the code you are using to report where the contact point is? I’m thinking the most likely possibility here is some subtle confusion between world space and local coordinates, but it would be helpful to be able to see exactly what the script is doing.

Thanks for the response. Yeah it sounds like it might be a local/world thing. It’s about 0.6 units out (negative along the normal).

Here is a snippet of the code that produces it. Pretty simple really. This code is attached to the player so it’s his ControlCollider triggering it.

    Vector3 polePointToRotateAround = Vector3.zero;

    void OnControllerColliderHit(ControllerColliderHit collisionInfo)
    {
         polePointToRotateAround = collisionInfo.point;
    }

    void OnDrawGizmosSelected()
    {
        Gizmos.DrawIcon(polePointToRotateAround, "YellowDot.tif");
    }

Nothing else modifies that ‘polePointToRotateAround’ variable.

In fact, here is a sample project that shows what I’m talking about.

196450–7087–$collisionexample_211.unitypackage (6.09 KB)

Anybody have any insight on what causes this?

I can correct it manually but it just seems weird.