void EditorUpdate() { if (Data == null) { return; } if (Playing) { PlayTime += Timescale * (float)Utility.GetElapsedTime(Timestamp); if (PlayTime > Data.GetTotalTime()) { PlayTime -= Data.GetTotalTime(); } Timestamp = Utility.GetTimestamp(); } CheckSkeleton(); MotionData.Frame frame = GetCurrentFrame(); Matrix4x4 root = frame.GetRoot(ShowMirrored); Actor.GetRoot().position = root.GetPosition(); Actor.GetRoot().rotation = root.GetRotation(); for (int i = 0; i < Actor.Bones.Length; i++) { Matrix4x4 transformation = frame.GetBoneTransformation(i, ShowMirrored); Actor.Bones[i].Transform.position = transformation.GetPosition(); Actor.Bones[i].Transform.rotation = transformation.GetRotation(); } SceneView.RepaintAll(); }
public float[] GetFeature(MotionData.Frame frame) { int dim = 6 * frame.Data.Source.Bones.Length; float[] feature = new float[dim]; int pivot = 0; Matrix4x4 root = frame.GetRootTransformation(false); for (int i = 0; i < frame.Data.Source.Bones.Length; i++) { feature[pivot + i] = frame.GetBoneTransformation(i, false).GetRelativeTransformationTo(root).GetPosition().x; } pivot += frame.Data.Source.Bones.Length; for (int i = 0; i < frame.Data.Source.Bones.Length; i++) { feature[pivot + i] = frame.GetBoneTransformation(i, false).GetRelativeTransformationTo(root).GetPosition().x; } pivot += frame.Data.Source.Bones.Length; for (int i = 0; i < frame.Data.Source.Bones.Length; i++) { feature[pivot + i] = frame.GetBoneTransformation(i, false).GetRelativeTransformationTo(root).GetPosition().x; } pivot += frame.Data.Source.Bones.Length; for (int i = 0; i < frame.Data.Source.Bones.Length; i++) { feature[pivot + i] = frame.GetBoneVelocity(i, false).GetRelativeDirectionTo(root).x; } pivot += frame.Data.Source.Bones.Length; for (int i = 0; i < frame.Data.Source.Bones.Length; i++) { feature[pivot + i] = frame.GetBoneVelocity(i, false).GetRelativeDirectionTo(root).y; } pivot += frame.Data.Source.Bones.Length; for (int i = 0; i < frame.Data.Source.Bones.Length; i++) { feature[pivot + i] = frame.GetBoneVelocity(i, false).GetRelativeDirectionTo(root).z; } pivot += frame.Data.Source.Bones.Length; return(feature); }