static int __CreateInstance(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <UnityEngine.Vector3>(L, 2) && translator.Assignable <UnityEngine.Vector3>(L, 3)) { UnityEngine.Vector3 origin; translator.Get(L, 2, out origin); UnityEngine.Vector3 direction; translator.Get(L, 3, out direction); UnityEngine.Ray __cl_gen_ret = new UnityEngine.Ray(origin, direction); translator.PushUnityEngineRay(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 1) { translator.PushUnityEngineRay(L, default(UnityEngine.Ray)); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Ray constructor!")); }
private UnityEngine.Vector3 MouseProjectedPosOnPlaneY(UnityEngine.Camera camera, float y, out bool collide) { if (camera == null) { collide = false; return(UnityEngine.Vector3.zero); } UnityEngine.Vector3 mousePosition = UnityEngine.Input.mousePosition; UnityEngine.Ray ray = camera.ScreenPointToRay(mousePosition); UnityEngine.Vector3 result = UnityEngine.Vector3.zero; collide = ray.direction.y != 0; if (collide) { float factor = (y - ray.origin.y) / ray.direction.y; collide = factor > 0; if (collide) { result = ray.origin + ray.direction * factor; } } return(result); }
public static Cell?Raycast(Ray ray, int level, BoundsMap bounds, Func <Cell, float> heightAt, Transform gridTransform = null) { var hit = Triangle.Raycast(ray, level, bounds, heightAt, gridTransform); if (!hit.HasValue) { return(null); } var barycentric = hit.Value.BarycentricCoordinate; var triangle = hit.Value.Triangle; if ((barycentric.x >= barycentric.y) && (barycentric.x >= barycentric.z)) { return(triangle.GetVertices(level).ElementAt(0)); } else if ((barycentric.y >= barycentric.x) && (barycentric.y >= barycentric.z)) { return(triangle.GetVertices(level).ElementAt(1)); } else { return(triangle.GetVertices(level).ElementAt(2)); } }
static object PerformMemberwiseClone(ref object o) { var ins = new UnityEngine.Ray(); ins = (UnityEngine.Ray)o; return(ins); }
static StackObject *get_direction_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); 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), (CLR.Utils.Extensions.TypeFlags) 16); var result_of_this_method = instance_of_this_method.direction; ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); if (ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Vector3_Binding_Binder != null) { ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Vector3_Binding_Binder.PushValue(ref result_of_this_method, __intp, __ret, __mStack); return(__ret + 1); } else { return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); } }
public void Get(RealStatePtr L, int index, out UnityEngine.Ray val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay_TypeID) { throw new Exception("invalid userdata for UnityEngine.Ray"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.UnPack(buff, 0, out val)) { throw new Exception("unpack fail for UnityEngine.Ray"); } } else if (type == LuaTypes.LUA_TTABLE) { CopyByValue.UnPack(this, L, index, out val); } else { val = (UnityEngine.Ray)objectCasters.GetCaster(typeof(UnityEngine.Ray))(L, index, null); } }
private UnityEngine.GameObject GetCurrentGOUnderTheMouse() { UnityEngine.Ray mouseRay = this.usedCamera.ScreenPointToRay(UnityEngine.Input.mousePosition); UnityEngine.RaycastHit[] rayCastHit = UnityEngine.Physics.RaycastAll(mouseRay); if (rayCastHit != null && rayCastHit.Length > 0) { UnityEngine.GameObject raycastGO = null; // ; UnityEngine.Vector3 cameraPos = this.usedCamera.transform.position; float bestDistanceToCamera = 0; for (int i = 0; i < rayCastHit.Length; ++i) { UnityEngine.GameObject go = rayCastHit[i].collider.gameObject; UnityEngine.Vector3 objectPos = go.transform.position; float distanceToCamera = (objectPos - cameraPos).magnitude; if (distanceToCamera < bestDistanceToCamera || raycastGO == null) { bestDistanceToCamera = distanceToCamera; raycastGO = go; } } return(raycastGO); } return(null); }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.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); UnityEngine.Vector3 @direction = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector3 @origin = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = new UnityEngine.Ray(@origin, @direction); if (!isNewObj) { __ret--; WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method); return(__ret); } return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public void Write(UnityEngine.Ray r) { WriteObjectStart(); WritePropertyName("origin"); Write(r.origin); WritePropertyName("direction"); Write(r.direction); WriteObjectEnd(); }
public static RaycastInput RaycastInputFromRay(Ray ray, CollisionFilter filter, float maxRayDist = MaxRayDist) { return(new RaycastInput { Start = ray.origin, End = ray.origin + ray.direction * maxRayDist, Filter = filter }); }
public UnityEngine.Vector3 GetIntersectionPoint(UnityEngine.Vector2 screenPosition) { UnityEngine.Ray ray = this.usedCamera.ScreenPointToRay(screenPosition); UnityEngine.Vector3 hitPos = UnityEngine.Vector3.zero; if ((ray.direction.y < 0) == (ray.origin.y > 0)) { hitPos = ray.origin - ray.direction * (ray.origin.y / ray.direction.y); } return(hitPos); }
private void RayCheck(ref UnityEngine.Ray ray, ref Side side, int i) { switch (i) { case 0: ray = new UnityEngine.Ray(this.transform.position, this.transform.forward); //#if UNITY_EDITOR // UnityEngine.Debug.DrawRay(this.transform.position, this.transform.forward, UnityEngine.Color.cyan, 1f); //#endif //#if UNITY_EDITOR_64 // UnityEngine.Debug.DrawRay(this.transform.position, this.transform.forward, UnityEngine.Color.cyan, 1f); //#endif side = Side.Front; break; case 1: ray = new UnityEngine.Ray(this.transform.position, this.transform.right); //#if UNITY_EDITOR // UnityEngine.Debug.DrawRay(this.transform.position, this.transform.right, UnityEngine.Color.cyan, 1f); //#endif //#if UNITY_EDITOR_64 // UnityEngine.Debug.DrawRay(this.transform.position, this.transform.forward, UnityEngine.Color.cyan, 1f); //#endif side = Side.Right; break; case 2: ray = new UnityEngine.Ray(this.transform.position, -this.transform.forward); //#if UNITY_EDITOR // UnityEngine.Debug.DrawRay(this.transform.position, -this.transform.forward, UnityEngine.Color.cyan, 1f); //#endif //#if UNITY_EDITOR_64 // UnityEngine.Debug.DrawRay(this.transform.position, this.transform.forward, UnityEngine.Color.cyan, 1f); //#endif side = Side.Back; break; case 3: ray = new UnityEngine.Ray(this.transform.position, -this.transform.right); //#if UNITY_EDITOR // UnityEngine.Debug.DrawRay(this.transform.position, -this.transform.right, UnityEngine.Color.cyan, 1f); //#endif //#if UNITY_EDITOR_64 // UnityEngine.Debug.DrawRay(this.transform.position, this.transform.forward, UnityEngine.Color.cyan,1f); //#endif side = Side.Left; break; default: UnityEngine.Debug.LogError("Default switch case in RayCheck"); break; } }
public static bool Pack(IntPtr buff, int offset, UnityEngine.Ray field) { if (!Pack(buff, offset, field.origin)) { return(false); } if (!Pack(buff, offset + 12, field.direction)) { return(false); } return(true); }
static StackObject *DrawRay_0(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, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Ray r = (UnityEngine.Ray) typeof(UnityEngine.Ray).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); UnityEngine.Gizmos.DrawRay(r); return(__ret); }
public void PushUnityEngineRay(RealStatePtr L, UnityEngine.Ray val) { if (UnityEngineRay_TypeID == -1) { bool is_first; UnityEngineRay_TypeID = getTypeId(L, typeof(UnityEngine.Ray), out is_first); } IntPtr buff = LuaAPI.xlua_pushstruct(L, 24, UnityEngineRay_TypeID); if (!CopyByValue.Pack(buff, 0, val)) { throw new Exception("pack fail fail for UnityEngine.Ray ,value=" + val); } }
public System.Boolean IntersectRay(UnityEngine.Ray ray) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Boolean IntersectRay(Ray)")) { m_functionCallCounts.Add("Boolean IntersectRay(Ray)", 0); } m_functionCallCounts["Boolean IntersectRay(Ray)"]++; throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
/// <summary>Write a ray (24 bytes) to the writer.</summary> /// <param name="value">Ray to write.</param> public void Write(UnityEngine.Ray value) { if (Disposed) { throw new ObjectDisposedException(GetType().FullName); } Internal = Allocator.ExpandMessage(Internal, Position, 24); Serializer.WriteSingle(Internal, Position, value.origin.x); Serializer.WriteSingle(Internal, Position + 4, value.origin.y); Serializer.WriteSingle(Internal, Position + 8, value.origin.z); Serializer.WriteSingle(Internal, Position + 12, value.direction.x); Serializer.WriteSingle(Internal, Position + 16, value.direction.y); Serializer.WriteSingle(Internal, Position + 20, value.direction.z); Position += 24; }
private UnityEngine.Vector3 MouseProjectedPosOnPlaneY(float y) { if (this.usedCamera != null) { UnityEngine.Vector3 mousePosition = UnityEngine.Input.mousePosition; UnityEngine.Camera camera = this.usedCamera; UnityEngine.Ray ray = camera.ScreenPointToRay(mousePosition); return(ray.origin - ray.direction * ((ray.origin.y - y) / ray.direction.y)); } else { return(UnityEngine.Vector3.zero); } }
static void WriteBackInstance(CSHotFix.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.Ray instance_of_this_method) { ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.Object: { __mStack[ptr_of_this_method->Value] = instance_of_this_method; } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method; } else { var t = __domain.GetType(___obj.GetType()) as CLRType; t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if (t is ILType) { ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method; } else { ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.Ray[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method; } break; } }
public void SetConnectedCubes() { UnityEngine.Ray ray = new UnityEngine.Ray(UnityEngine.Vector3.zero, UnityEngine.Vector3.zero); Side side = Side.Front; for (int i = 0; i < 4; i++) { this.RayCheck(ref ray, ref side, i); UnityEngine.RaycastHit hit; UnityEngine.Physics.Raycast(ray, out hit); if (hit.transform.tag == C.FLOOR_TAG) { this.ConnectedCubes.Add(side, hit.transform.GetComponent <Cube>()); } } }
public override void Report(WebInterface.ACTION_BUTTON buttonId, Ray ray, HitInfo hit) { if (!enabled || !IsVisible()) { return; } Model model = this.model as OnPointerEvent.Model; if (ShouldReportEvent(buttonId, hit)) { string meshName = pointerEventHandler.GetMeshName(hit.collider); DCL.Interface.WebInterface.ReportOnPointerDownEvent(buttonId, scene.sceneData.id, model.uuid, entity.entityId, meshName, ray, hit.point, hit.normal, hit.distance); } }
public System.Boolean Raycast(UnityEngine.Ray ray, out System.Single enter) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Boolean Raycast(Ray, Single ByRef)")) { m_functionCallCounts.Add("Boolean Raycast(Ray, Single ByRef)", 0); } m_functionCallCounts["Boolean Raycast(Ray, Single ByRef)"]++; enter = default(System.Single); throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public TriangleHit?Raycast(Ray ray, int level, Func <Cell, float> heightAt) { Vector3 v0, v1, v2; using (var vertices = GetVertices(level).GetEnumerator()) { vertices.MoveNext(); v0 = vertices.Current.Position * heightAt(vertices.Current); vertices.MoveNext(); v1 = vertices.Current.Position * heightAt(vertices.Current); vertices.MoveNext(); v2 = vertices.Current.Position * heightAt(vertices.Current); } var e1 = v1 - v0; var e2 = v2 - v0; var p = Vector3.Cross(ray.direction, e2); var a = Vector3.Dot(e1, p); if (a <= 0) { return(null); } var f = 1 / a; var s = ray.origin - v0; var u = f * Vector3.Dot(s, p); if (u < 0 || u > 1) { return(null); } var q = Vector3.Cross(s, e1); var v = f * Vector3.Dot(ray.direction, q); var w = u + v; if (v < 0 || w > 1) { return(null); } var t = f * Vector3.Dot(e2, q); return(new TriangleHit(this, t, new Vector3(1 - w, u, v))); }
static StackObject *ToString_5(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, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); 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.ToString(); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); 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 void UpdateUnityEngineRay(RealStatePtr L, int index, UnityEngine.Ray val) { if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay_TypeID) { throw new Exception("invalid userdata for UnityEngine.Ray"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.Pack(buff, 0, val)) { throw new Exception("pack fail for UnityEngine.Ray ,value=" + val); } } else { throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index)); } }
public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Ray val) { val = new UnityEngine.Ray(); int top = LuaAPI.lua_gettop(L); if (XUtils.LoadField(L, idx, "origin")) { var origin = val.origin; translator.Get(L, top + 1, out origin); val.origin = origin; } LuaAPI.lua_pop(L, 1); if (XUtils.LoadField(L, idx, "direction")) { var direction = val.direction; translator.Get(L, top + 1, out direction); val.direction = direction; } LuaAPI.lua_pop(L, 1); }
static int _m_ScreenPointToRay_xlua_st_(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { { UnityEngine.Camera cam = (UnityEngine.Camera)translator.GetObject(L, 1, typeof(UnityEngine.Camera)); UnityEngine.Vector2 screenPos; translator.Get(L, 2, out screenPos); UnityEngine.Ray __cl_gen_ret = UnityEngine.RectTransformUtility.ScreenPointToRay(cam, screenPos); translator.PushUnityEngineRay(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Ray field) { field = default(UnityEngine.Ray); var origin = field.origin; if (!UnPack(buff, offset, out origin)) { return(false); } field.origin = origin; var direction = field.direction; if (!UnPack(buff, offset + 12, out direction)) { return(false); } field.direction = direction; return(true); }
static StackObject *set_direction_3(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); UnityEngine.Vector3 @value = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); 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)); instance_of_this_method.direction = value; 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(__ret); }
static StackObject *IntersectRay_2(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); UnityEngine.Ray ray = (UnityEngine.Ray) typeof(UnityEngine.Ray).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); UnityEngine.Bounds instance_of_this_method; instance_of_this_method = (UnityEngine.Bounds) typeof(UnityEngine.Bounds).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.IntersectRay(ray); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }