I have a terrain object. when I CapsuleCast from camera to terrain the game slows down badly. However if I raycast other GameObjects it does not slows down?
Does this have to do with terrain resolution or stuff?
int i = 0;
while (i < Input.touchCount) {
if (Input.GetTouch (i).phase == TouchPhase.Began) {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay (Input.GetTouch (i).position);
Vector3 p1 = ray.origin;
Vector3 p2 = ray.origin + (ray.direction * pickDistance);
if (Physics.CapsuleCast (p1, p2, pickRadius, ray.direction, out hit, pickDistance)) {
Debug.Log ("hit something");
}
}
}
++i;