// Update is called once per frame void Update() { hitPosition = Vector3.zero; hitSphereCenter = Vector3.zero; RaycastHit hitInfo; if (Physics.SphereCast(transform.position, boundingRadius, Vector3.down, out hitInfo)) { hitPosition = hitInfo.point; hitSphereCenter = transform.position + (Vector3.down * (hitInfo.distance + boundingRadius)); SteeringBasics.debugCross(hitPosition, 0.5f, Color.yellow); SteeringBasics.debugCross(hitSphereCenter, 0.5f, Color.red); if (isWall(hitInfo.normal)) { /* Get vector pointing down the slope) */ Vector3 rightSlope = Vector3.Cross(hitInfo.normal, Vector3.down); Vector3 downSlope = Vector3.Cross(rightSlope, hitInfo.normal); RaycastHit rayHitInfo; if (Physics.Raycast(hitInfo.point, downSlope, out rayHitInfo)) { SteeringBasics.debugCross(rayHitInfo.point, 0.5f, Color.magenta); } } } }