private Vector3i?GetCursor(bool inside) { UnityEngine.Ray ray = new UnityEngine.Ray(_cameraTrans.position, _cameraTrans.forward); UnityEngine.Vector3?point = MapRayIntersection.Intersection(_map, ray, 10); if (point.HasValue) { UnityEngine.Vector3 pos = point.Value; if (inside) { pos += ray.direction * 0.01f; } if (!inside) { pos -= ray.direction * 0.01f; } int posX = UnityEngine.Mathf.RoundToInt(pos.x); int posY = UnityEngine.Mathf.RoundToInt(pos.y); int posZ = UnityEngine.Mathf.RoundToInt(pos.z); return(new Vector3i(posX, posY, posZ)); } return(null); }
private Vector3i?GetCursor(bool inside) { Ray ray = new Ray(cameraTrans.position, cameraTrans.forward); Vector3?point = MapRayIntersection.Intersection(map, ray, this.cursor_range); if (point.HasValue) { Vector3 pos = point.Value; if (inside) { pos += ray.direction * 0.01f; } if (!inside) { pos -= ray.direction * 0.01f; } int posX = Mathf.RoundToInt(pos.x); int posY = Mathf.RoundToInt(pos.y); int posZ = Mathf.RoundToInt(pos.z); return(new Vector3i(posX, posY, posZ)); } return(null); }