Created
September 6, 2018 05:20
-
-
Save Problematic/e53a81528cfe5e1ef74f0b478cc5b0da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[CreateAssetMenu(menuName = "Problematic/Query Helper")] | |
public class QueryHelper : ScriptableObject | |
{ | |
[SerializeField] | |
protected float maxDistance = Mathf.Infinity; | |
[SerializeField] | |
protected LayerMask layerMask = ~0; | |
[SerializeField] | |
protected QueryTriggerInteraction queryTriggerInteraction; | |
public bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hitInfo) | |
{ | |
return Physics.Raycast(origin, direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction); | |
} | |
public bool Raycast(Ray ray, out RaycastHit hitInfo) | |
{ | |
return Physics.Raycast(ray, out hitInfo, maxDistance, layerMask, queryTriggerInteraction); | |
} | |
public RaycastHit[] RaycastAll(Vector3 origin, Vector3 direction) | |
{ | |
return Physics.RaycastAll(origin, direction, maxDistance, layerMask, queryTriggerInteraction); | |
} | |
public RaycastHit[] RaycastAll(Ray ray) | |
{ | |
return Physics.RaycastAll(ray, maxDistance, layerMask, queryTriggerInteraction); | |
} | |
public int RaycastNonAlloc(Vector3 origin, Vector3 direction, RaycastHit[] results) | |
{ | |
return Physics.RaycastNonAlloc(origin, direction, results, maxDistance, layerMask, queryTriggerInteraction); | |
} | |
public int RaycastNonAlloc(Ray ray, RaycastHit[] results) | |
{ | |
return Physics.RaycastNonAlloc(ray, results, maxDistance, layerMask, queryTriggerInteraction); | |
} | |
public Collider[] OverlapSphere(Vector3 position, float radius) | |
{ | |
return Physics.OverlapSphere(position, radius, layerMask, queryTriggerInteraction); | |
} | |
public int OverlapSphereNonAlloc(Vector3 position, float radius, Collider[] results) | |
{ | |
return Physics.OverlapSphereNonAlloc(position, radius, results, layerMask, queryTriggerInteraction); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment