/// <summary> /// Sends an <see cref="ARViewUpdate"/> with the current position /// and rotation. /// </summary> public void Update() { Vector3 position = this.transform.position; ARViewUpdate update = new ARViewUpdate(this.PlayerId, position, this.transform.eulerAngles); this.SendMessageUpwards("OnFollowPlayerInfo", update); }
/// <summary> /// Sends an <see cref="ARViewUpdate"/> with the current position /// and rotation. /// </summary> public void Update() { LevelManager manager = this.transform.parent.GetComponent <LevelManager>(); transform.position = new Vector3(manager.BoardSize.x / 2, 30, manager.BoardSize.y / 2); Vector3 position = this.transform.position; ARViewUpdate update = new ARViewUpdate(FakeOverviewPlayerId, position, this.transform.eulerAngles); this.SendMessageUpwards("OnFollowPlayerInfo", update); }
/// <summary> /// Places the given <see cref="RemotePlayerMarker"/> at the position and /// rotation indicated by the <see cref="ARViewUpdate"/>. /// </summary> /// <param name="head">The <see cref="RemotePlayerMarker"/>.</param> /// <param name="playerInfo">The <see cref="ARViewUpdate"/>.</param> public void PlacePlayerHead(RemotePlayerMarker head, ARViewUpdate playerInfo) { Assert.IsNotNull(head); Assert.IsNotNull(playerInfo); int markerId = playerInfo.Id + PlayerIdOffset; Vector3 position = playerInfo.Position; //Quaternion direction = Quaternion.Euler(playerInfo.Rotation); Quaternion direction = Quaternion.LookRotation(playerInfo.Rotation - position); if (this.trackingIndex == -1) { this.NextTracking(); } this.GetPlayer(playerInfo.Id).RemotePosition = new MarkerPosition(position, direction, DateTime.Now, Vector3.one, markerId); //Debug.LogWarning("LOCAL " + position); }
/// <summary> /// Updates the position of a player as indicated by the argument /// <see cref="ARViewUpdate"/>. /// </summary> /// <param name="update">The <see cref="ARViewUpdate"/>.</param> public void OnFollowPlayerInfo(ARViewUpdate update) { this.PlacePlayerHead(this.GetPlayer(update.Id), update); }