public Coordinates GetCoordinates() { MumbleLinkedMemory l = Read(); /* * Note that the mumble coordinates differ from the actual in-game coordinates. * They are in the format x,z,y and z has been negated so that underwater is negative * rather than positive. * * Coordinates are based on a central point (0,0), which may be the center of the zone, * where traveling west is negative, east is positive, north is positive and south is negative. * */ var coord = new Coordinates() { X = l.FAvatarPosition[0] * MeterToInch, //west to east Y = l.FAvatarPosition[2] * MeterToInch, //north to south Z = -l.FAvatarPosition[1] * MeterToInch, //altitude WorldId = BitConverter.ToInt64(l.Context, 36), MapId = BitConverter.ToInt64(l.Context, 28) }; return(coord); }
private void Update() { this.Camera.fieldOfView = this.Mumble.Link.GetIdentity().Fov *Mathf.Rad2Deg; MumbleLinkedMemory mem = this.Mumble.Link.Read(); this.transform.position = new Vector3(mem.FCameraPosition[0], mem.FCameraPosition[1], mem.FCameraPosition[2]); this.transform.rotation = Quaternion.LookRotation( new Vector3(mem.FCameraFront[0], mem.FCameraFront[1], mem.FCameraFront[2])); }
private void Update() { var identity = this.Mumble.Link.GetIdentity(); if (identity == null || string.IsNullOrEmpty(identity.Name)) { return; } this.Camera.fieldOfView = identity.Fov * Mathf.Rad2Deg; MumbleLinkedMemory mem = this.Mumble.Link.Read(); this.transform.position = new Vector3(mem.FCameraPosition[0], mem.FCameraPosition[1], mem.FCameraPosition[2]); this.transform.rotation = Quaternion.LookRotation( new Vector3(mem.FCameraFront[0], mem.FCameraFront[1], mem.FCameraFront[2])); }
void Update() { mem = link.Read(); /*int size = Marshal.SizeOf(typeof(GW2Context)); * IntPtr ptr = Marshal.AllocHGlobal(size); * Marshal.Copy(mem.Context, 0, ptr, size); * var context = (GW2Context)Marshal.PtrToStructure(ptr, typeof(GW2Context)); * Marshal.FreeHGlobal(ptr);*/ if (mem.Identity != null) { bool identityChanged = mIdentityCache == null || mIdentityCache.Length != mem.Identity.Length; int length = 0; for (; length < mem.Identity.Length; length++) { if (mem.Identity[length] == 0) { break; } if (!identityChanged && mIdentityCache[length] != mem.Identity[length]) { identityChanged = true; } } if (identityChanged) { var identityStr = new string(mem.Identity, 0, length); mIdentity = JsonConvert.DeserializeObject <Gw2Identity>(identityStr); mIdentityCache = mem.Identity; } } else { mIdentity = null; mIdentityCache = null; } }
private void Update() { MumbleLinkedMemory mem = this.Mumble.Link.Read(); this.transform.position = new Vector3(mem.FAvatarPosition[0], mem.FAvatarPosition[1], mem.FAvatarPosition[2]); }