Animation Problem

So I imported a mocap animation from Mixamo today and as you can in the GIF below, the character jumps forward, away from the HumanoidRootPart. Is there a way to systematically manipulate each keyframe so that the LowerTorso’s relative Z position to the HumanoidRootPart will not change?

https://gyazo.com/509eb1a68bd2652ef098f93e1b055056

4 Likes

If I’ve understood your question correctly, no; the animation editor won’t physically move parts (to my knowledge), so if you wanted the lower torso to stay on the same Z position as the humanoid root part, but still had the character jump forwards, you’d have to physically move the character forward (and the animation would only show jumping up) rather than doing it with the animation editor.

You may be able to use code in the command line to go through the animation keyframes and edit the CFrame values.

Give this a try. In studio explorer panel, look under the character that the animation is saved on. You should see a folder named “AnimSaves”. Select the animation you want, then put this code in the command bar.

for _,pose in pairs((game.Selection:Get()[1]):GetDescendants()) do
	if pose.Name == 'LowerTorso' then
		pose.CFrame = (pose.CFrame - Vector3.new(0,0,pose.CFrame.p.z))
	end
end
8 Likes

Ohhh, that’s exactly what I was looking for. Thank you!

1 Like

Are you passing these animations through Blender, and if so, do you know how to use the Graph Editor? There is a quick and easy visual way to do this that will help if you have animations where you want to preserve some movement of the LowerTorso (even on the axis being corrected), but remove unwanted offsets and convert the animation to run “in place”.

1 Like

I am passing through it Blender but I don’t know how to use the Graph Editor. I’ll look into it when I get home. Thank you!

OK cool. If you can’t figure it out, I can make a few screenshots for you when I get home. Basically, you find the axis of the LowerTorso position where you have translation, which is easy because it will be a ramp shape rather than a flat horizontal line. You isolate this coordinate by unchecking all the others, select all the keyframes, and then scale on the Y axis (S key, Y key, just like for things in 3D view). If you scale to 0, that ramp becomes a flat line, and voila, no more offset! Translating up and down with G and Y, you can center the animation where you want, e.g. line it up with the HumanoidRootPart.

For your simple case, the scripting solution is probably just as good. It’s when you have an animation where you want most of the translation, but which does not loop cleanly back to where it started, where the Graph Editor is the superior option. You have the full power of proportional editing in this UI too!

1 Like

Okay thank you! I’ll definitely try it out when I get home, but I’m a complete noob in Blender though so no guarantee I’ll figure it out :sweat_smile: