47 float smallest_dist = float.PositiveInfinity;
48 Collider smallest_coll = null;
49 Vector3 closest_point = Vector3.zero;
51 for (
int i = 0; i < colliders.Count; i++)
55 colliders.RemoveAt(i);
61 Vector3 p = c.ClosestPoint(GrabPoint.position);
62 if (Vector3.Distance(p,
GrabPoint.position) < smallest_dist)
64 smallest_dist = Vector3.Distance(p, GrabPoint.position);
70 if(smallest_coll==null) {
75 AVR_Grabbable grb = smallest_coll.GetComponentInParent<AVR_Grabbable>();
78 AVR.Core.AVR_DevConsole.cwarn(
"Attempted to grab a collider without an AVR_Grabbable component. Either 1) attatch an AVR_Grabbable to the respective object, or 2), disable collisions between the volumefinder and the given object.",
this);
83 if(grb.grabNodes!=null) {
84 foreach(var node
in grb.grabNodes) {
85 if(Vector3.Distance(
GrabPoint.position, node.transform.position) < node.override_radius) {
86 location =
new GrabLocation(grb, closest_point, smallest_dist, node);
92 location =
new GrabLocation(grb, closest_point, smallest_dist, smallest_coll);
List< Collider > colliders