Question by
terrydif · Jul 17, 2016 at 02:42 PM ·
collisionraycastingcharacter controller
Raycast on Character Controller is...inset?
Hi, this is a strange problem that I've never noticed before. I'm trying to raycast to the surface of a Character Controller. It works fine, except it's acting as if the character controller collider is "inset" by a small, but significant amount.
Here is a Gif showing the issue (the cross is the raycast point, being moved vertically along the center of the collider):
I've tried changing all the settings on the controller, like Skin Width, and they have no effect. If I resize the height or radius of the controller, the problem persists, and the new inset is simply relative to the new size of the controller. My raycasting code is simple, so the problem likely isn't there:
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 100, layerMask))
{
DrawCross(hit.point);
}
Comment