Hyluss

[Unity] RaycastHit with LayerMask

Sep 25th, 2017
256
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.24 KB | None | 0 0
  1. int layerMask = 1 << 8;
  2. Vector3 direction = player.transform.position - transform.position;
  3. RaycastHit[] hits = Physics.RaycastAll(transform.position, direction, Mathf.Infinity, layerMask);
  4. Debug.DrawRay (transform.position, direction, Color.red);
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment