/// <summary> /// Only guaranteed to be correct for convex colliders. /// </summary> public bool CollidesWith(UnityEngine.Collider unityCollider, bool includeBehindPlane = false) { var planePose = this.pose; var planePoseInverse = this.pose.inverse(); var colliderCenter = getUnityColliderWorldCenter(unityCollider); var colliderCenter_plane = planePoseInverse.mul(colliderCenter).position; var colliderCenterOnPlane_plane = colliderCenter_plane.WithZ(0f); var colliderCenterOnPlane = planePose.mul(colliderCenterOnPlane_plane).position; var closestPoint = unityCollider.ClosestPoint(colliderCenterOnPlane); var closestPoint_plane = planePoseInverse.mul(closestPoint).position; // Concave shapes will break here; projection from their center is not // valid. To support concavity, you'd want to project to the plane from // the planeward-most point on the concave collider. var planeToClosestPoint_plane = closestPoint_plane - colliderCenterOnPlane_plane; if (includeBehindPlane) { // Plane faces forward on Z. return(planeToClosestPoint_plane.z <= 0f); } else { return(planeToClosestPoint_plane.z == 0f); } }
static public int ClosestPoint(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.Collider self = (UnityEngine.Collider)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); var ret = self.ClosestPoint(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static public int ClosestPoint(IntPtr l) { try { UnityEngine.Collider self = (UnityEngine.Collider)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); var ret = self.ClosestPoint(a1); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
static int QPYX_ClosestPoint_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 2); UnityEngine.Collider QPYX_obj_YXQP = (UnityEngine.Collider)ToLua.CheckObject <UnityEngine.Collider>(L_YXQP, 1); UnityEngine.Vector3 QPYX_arg0_YXQP = ToLua.ToVector3(L_YXQP, 2); UnityEngine.Vector3 QPYX_o_YXQP = QPYX_obj_YXQP.ClosestPoint(QPYX_arg0_YXQP); ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int ClosestPoint(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Collider obj = (UnityEngine.Collider)ToLua.CheckObject <UnityEngine.Collider>(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); UnityEngine.Vector3 o = obj.ClosestPoint(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ClosestPoint(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.Collider.ClosestPoint"); #endif try { ToLua.CheckArgsCount(L, 2); UnityEngine.Collider obj = (UnityEngine.Collider)ToLua.CheckObject <UnityEngine.Collider>(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); UnityEngine.Vector3 o = obj.ClosestPoint(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }