static StackObject *GetPoint_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @distance = *(float *)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); UnityEngine.Ray instance_of_this_method = (UnityEngine.Ray) typeof(UnityEngine.Ray).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.GetPoint(@distance); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public static FLOAT3 GetNearestPositionToTarget(FLOAT3 from, FLOAT3 target, float minRange, float maxRange) { var dir = target - from; var distanceSqr = dir.sqrMagnitude; if (distanceSqr <= maxRange * maxRange && distanceSqr >= minRange * minRange) { return(from); } var tRange = maxRange; if (distanceSqr < minRange * minRange) { tRange = minRange; } var ray = new UnityEngine.Ray(target, from - target); return(ray.GetPoint(tRange)); }