Advertisement
LittleAngel

Untitled

Mar 23rd, 2011
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. Vector3 PerimeterCheck (Transform thisCarsTransform, Collider thisCarsCollider) {
  2. if (Physics.CheckSphere (thisCarsTransform.position, detectionRadius)) {
  3. Ray forwardRay = new Ray(thisCarsTransform.position, thisCarsTransform.forward);
  4. var hits = Physics.SphereCastAll(forwardRay, detectionRadius, detectionRadius);
  5. foreach (var hit in hits) {
  6. if (hit.collider != thisCarsCollider) {
  7. if (hit.transform.tag == "Player" || hit.transform.tag == "Car" || hit.transform.tag == "Boundary") {
  8. // Red = from origin to point
  9. Debug.DrawLine(forwardRay.origin, hit.point, Color.red);
  10. }
  11. }
  12. }
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement