public override void Setup() { TimeSeries = new TimeSeries(6, 6, 1f, 1f, 5); VelocitySeries = new TimeSeries.Velocity(TimeSeries); ActionSeries = new TimeSeries.Action(TimeSeries, "Neutral", "CrossArms", "LH on Hip", "RH on Hip"); PhaseSeries = new TimeSeries.Phase(TimeSeries); TrajectorySeries = new TimeSeries.Trajectory(TimeSeries); }
public OutputSIGGRAPHAsia(MotionEditor editor, float timestamp) { editor.LoadFrame(timestamp); Frame = editor.GetCurrentFrame(); Root = editor.GetActor().GetRoot().GetWorldMatrix(true); Posture = editor.GetActor().GetBoneTransformations(); Velocities = editor.GetActor().GetBoneVelocities(); TimeSeries = ((TimeSeriesModule)editor.GetData().GetModule(Module.ID.TimeSeries)).GetTimeSeries(Frame, editor.Mirror, 6, 6, 1f, 1f, 1, 1f / editor.TargetFramerate); RootSeries = (TimeSeries.Root)TimeSeries.GetSeries("Root"); StyleSeries = (TimeSeries.Style)TimeSeries.GetSeries("Style"); GoalSeries = (TimeSeries.Goal)TimeSeries.GetSeries("Goal"); ContactSeries = (TimeSeries.Contact)TimeSeries.GetSeries("Contact"); PhaseSeries = (TimeSeries.Phase)TimeSeries.GetSeries("Phase"); }
protected override void Setup() { Controller = new Controller(); Controller.Signal idle = Controller.AddSignal("Idle"); idle.Default = true; idle.Velocity = 0f; idle.AddKey(KeyCode.W, false); idle.AddKey(KeyCode.A, false); idle.AddKey(KeyCode.S, false); idle.AddKey(KeyCode.D, false); idle.AddKey(KeyCode.Q, false); idle.AddKey(KeyCode.E, false); idle.AddKey(KeyCode.V, true); idle.UserControl = 0.25f; idle.NetworkControl = 0.1f; Controller.Signal walk = Controller.AddSignal("Walk"); walk.AddKey(KeyCode.W, true); walk.AddKey(KeyCode.A, true); walk.AddKey(KeyCode.S, true); walk.AddKey(KeyCode.D, true); walk.AddKey(KeyCode.Q, true); walk.AddKey(KeyCode.E, true); walk.AddKey(KeyCode.LeftShift, false); walk.AddKey(KeyCode.C, false); walk.Velocity = 1f; walk.UserControl = 0.25f; walk.NetworkControl = 0.25f; Controller.Signal run = Controller.AddSignal("Run"); run.AddKey(KeyCode.LeftShift, true); run.Velocity = 3f; run.UserControl = 0.25f; run.NetworkControl = 0.25f; Controller.Signal carry = Controller.AddSignal("Carry"); carry.AddKey(KeyCode.V, true); carry.Velocity = 0f; carry.UserControl = 0.1f; carry.NetworkControl = 0f; Controller.Signal open = Controller.AddSignal("Open"); open.AddKey(KeyCode.F, true); open.Velocity = 0f; open.UserControl = 0.1f; open.NetworkControl = 0f; Controller.Signal sit = Controller.AddSignal("Sit"); sit.AddKey(KeyCode.C, true); sit.Velocity = 0f; sit.UserControl = 0.25f; sit.NetworkControl = 0f; Environment = new CylinderMap(4f, 9, 9, true); Geometry = new CuboidMap(new Vector3Int(8, 8, 8)); TimeSeries = new TimeSeries(6, 6, 1f, 1f, 5); RootSeries = new TimeSeries.Root(TimeSeries); StyleSeries = new TimeSeries.Style(TimeSeries, "Idle", "Walk", "Run", "Carry", "Open", "Sit", "Climb"); GoalSeries = new TimeSeries.Goal(TimeSeries, Controller.GetSignalNames()); ContactSeries = new TimeSeries.Contact(TimeSeries, "Hips", "RightWrist", "LeftWrist", "RightAnkle", "LeftAnkle"); PhaseSeries = new TimeSeries.Phase(TimeSeries); for (int i = 0; i < TimeSeries.Samples.Length; i++) { RootSeries.Transformations[i] = transform.GetWorldMatrix(true); if (StyleSeries.Styles.Length > 0) { StyleSeries.Values[i][0] = 1f; } if (GoalSeries.Actions.Length > 0) { GoalSeries.Values[i][0] = 1f; } GoalSeries.Transformations[i] = transform.GetWorldMatrix(true); PhaseSeries.Values[i] = Mathf.Repeat((float)i / GetFramerate(), 1f); Geometry.Pivot = transform.GetWorldMatrix(true); Geometry.References[i] = transform.position; } PosePrediction = new Vector3[Actor.Bones.Length]; RootPrediction = new Matrix4x4[7]; GoalPrediction = new Matrix4x4[7]; RightFootIK = UltimateIK.BuildModel(Actor.FindTransform("RightHip"), Actor.GetBoneTransforms(ContactSeries.Bones[3])); LeftFootIK = UltimateIK.BuildModel(Actor.FindTransform("LeftHip"), Actor.GetBoneTransforms(ContactSeries.Bones[4])); }
public TimeSeries GetTimeSeries(Frame frame, bool mirrored, int pastKeys, int futureKeys, float pastWindow, float futureWindow, int resolution, float delta) { TimeSeries timeSeries = new TimeSeries(pastKeys, futureKeys, pastWindow, futureWindow, resolution); foreach (Module module in Data.Modules) { if (module is RootModule) { RootModule m = (RootModule)module; TimeSeries.Root series = new TimeSeries.Root(timeSeries); for (int i = 0; i < timeSeries.Samples.Length; i++) { float t = frame.Timestamp + timeSeries.Samples[i].Timestamp; if (t < 0f || t > Data.GetTotalTime()) { series.Transformations[i] = m.GetEstimatedRootTransformation(frame, timeSeries.Samples[i].Timestamp, mirrored); series.Velocities[i] = m.GetEstimatedRootVelocity(frame, timeSeries.Samples[i].Timestamp, mirrored, delta); } else { series.Transformations[i] = m.GetRootTransformation(Data.GetFrame(t), mirrored); series.Velocities[i] = m.GetRootVelocity(Data.GetFrame(t), mirrored, delta); } } } if (module is StyleModule) { StyleModule m = (StyleModule)module; TimeSeries.Style series = new TimeSeries.Style(timeSeries, m.GetNames()); for (int i = 0; i < timeSeries.Samples.Length; i++) { float t = frame.Timestamp + timeSeries.Samples[i].Timestamp; series.Values[i] = m.GetStyles(Data.GetFrame(t)); } } if (module is GoalModule) { GoalModule m = (GoalModule)module; TimeSeries.Goal series = new TimeSeries.Goal(timeSeries, m.GetNames()); for (int i = 0; i < timeSeries.Samples.Length; i++) { float t = frame.Timestamp + timeSeries.Samples[i].Timestamp; series.Transformations[i] = m.Target.GetGoalTransformation(frame, timeSeries.Samples[i].Timestamp, mirrored, delta); series.Values[i] = m.GetActions(Data.GetFrame(t), delta); } } if (module is ContactModule) { ContactModule m = (ContactModule)module; TimeSeries.Contact series = new TimeSeries.Contact(timeSeries, m.GetNames()); for (int i = 0; i < timeSeries.Samples.Length; i++) { float t = frame.Timestamp + timeSeries.Samples[i].Timestamp; series.Values[i] = m.GetContacts(Data.GetFrame(t), mirrored); } } if (module is PhaseModule) { PhaseModule m = (PhaseModule)module; TimeSeries.Phase series = new TimeSeries.Phase(timeSeries); for (int i = 0; i < timeSeries.Samples.Length; i++) { float t = frame.Timestamp + timeSeries.Samples[i].Timestamp; series.Values[i] = m.GetPhase(Data.GetFrame(t), mirrored); } } } return(timeSeries); }