/// <summary> /// Apply the pose of an absolute clip. /// </summary> /// <param name="player">The player character</param> /// <param name="pose">The pose to apply</param> /// <param name="weight">(optional) The weighting on the pose, used to /// interpolate this pose with another if necessary. Default: 1.</param> /// <param name="updateVirtualSnapshot">(optional) Whether or not to update the mixer's virtual snapshot /// of the player character. When mixing multiple absolute poses, this /// action can be saved for the last pose applied. Default: true.</param> private void MixAbsolute(PlayerCharacter player, AbsolutePoseInfo pose, float weight = 1f, bool updateVirtualSnapshot = true) { PoseTools.MixAbsolute(player, VirtualSnapshot, pose, weight); if (updateVirtualSnapshot) { VirtualSnapshot = new PlayerSnapshot(player); } }
private void SetupTest() { player = TestingTools.ConstructPlayer(); player.transform.position = Vector3.zero; player.transform.eulerAngles = Vector3.one * 10; player.transform.localScale = Vector3.zero; player.SetFacing(Facing.Left); player.gameObject.SetActive(true); snapshot = new PlayerSnapshot(player); player.transform.position = Vector3.one; player.transform.eulerAngles = Vector3.one; player.transform.localScale = Vector3.one; player.SetFacing(Facing.Left); player.gameObject.SetActive(true); absA = new AbsolutePoseInfo(); absA.Position = new Vector3(-10, -10, -10); absA.Rotation = Vector3.zero; absA.Scale = new Vector3(-10, -10, -10); absA.State = typeof(SingleJumpFall); absA.Flipped = true; absA.Active = true; absB = new AbsolutePoseInfo(); absB.Position = new Vector3(10, 10, 10); absB.Rotation = new Vector3(20, 20, 20); absB.Scale = new Vector3(10, 10, 10); absB.State = typeof(Running); absB.Flipped = false; absB.Active = false; relA = new RelativePoseInfo(); relA.Position = new Vector3(-10, -10, -10); relA.Rotation = Vector3.zero; relA.Scale = new Vector3(-10, -10, -10); relA.State = typeof(SingleJumpFall); relA.Flipped = true; relA.Active = true; relB = new RelativePoseInfo(); relB.Position = new Vector3(10, 10, 10); relB.Rotation = new Vector3(20, 20, 20); relB.Scale = new Vector3(10, 10, 10); relB.State = typeof(Running); relB.Flipped = false; relB.Active = false; }
/// <summary> /// Apply the pose of an absolute clip. /// </summary> /// <param name="player">The player character</param> /// <param name="snapshot">A snapshot of player character information. This /// gets mixed into the player's pose as well.</param> /// <param name="pose">The pose to apply</param> /// <param name="weight">(optional) The weighting on the pose, used to /// interpolate this pose with another if necessary. Default: 1.</param> /// <param name="updateVirtualSnapshot">(optional) Whether or not to update the mixer's virtual snapshot /// of the player character. When mixing multiple absolute poses, this /// action can be saved for the last pose applied. Default: true.</param> public static void MixAbsolute(PlayerCharacter player, PlayerSnapshot snapshot, AbsolutePoseInfo pose, float weight = 1f) { Vector3 pos = snapshot.Position; Vector3 rot = snapshot.Rotation; Vector3 scl = snapshot.Scale; player.transform.position = (pose.Position - pos) * weight + pos; player.transform.eulerAngles = (pose.Rotation - rot) * weight + rot; player.transform.localScale = (pose.Scale - scl) * weight + scl; }