Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Make animations work slightly better by allowing hip position as the root bone.

Scott Petrovicf5946d1ae010
diff --git a/src/lib/processes/StepAnimationsListing.ts b/src/lib/processes/StepAnimationsListing.ts
index d779948..ba29005 100644
--- a/src/lib/processes/StepAnimationsListing.ts
+++ b/src/lib/processes/StepAnimationsListing.ts
@@ -100,10 +100,12 @@ export class StepAnimationsListing extends EventTarget {
animation_clips.forEach((animation_clip: AnimationClip) => {
// remove all position nodes except root
let rotation_tracks: KeyframeTrack[] = []
+
+
if (preserve_root_position) {
- rotation_tracks = animation_clip.tracks.filter((x: KeyframeTrack) => x.name.includes('quaternion') || x.name.includes('root.position'))
+ rotation_tracks = animation_clip.tracks.filter((x: KeyframeTrack) => x.name.includes('quaternion') || x.name.includes('hips.position'))
} else {
- rotation_tracks = animation_clip.tracks.filter((x: KeyframeTrack) => x.name.includes('quaternion'))
+ rotation_tracks = animation_clip.tracks.filter((x: KeyframeTrack) => x.name.includes('quaternion') || x.name.includes('hips.position'))
}
animation_clip.tracks = rotation_tracks // update track data