How to counter translation for game sprites?

Wondering how to accomplish a certain animation task? Ask here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
Daxel
Posts: 1081
Joined: Wed Mar 27, 2019 8:34 pm

How to counter translation for game sprites?

Post by Daxel »

I have to make sprites for a game character: running, jumping etc. And I want to reuse some bone animations I have but I have to counter the translation in them because game characters stay in the same place, the translation is applied in the game engine moving the sprite position. If my animations didn't use target bones for legs and sometimes for arms, I guess it would be easy: most of the times I would only have to delete the translation keyframes of the root bone and the translation of the character would be gone right? But the problem is that the animations I want to reuse rely on targets so if you do that the animation doesn't work because the targets would keep trying to translate the legs etc.

So I wanted to know what would you guys do. I could animate the camera to follow the master bone, or animate the bone layer the opposite way of the master bone... but I guess it could get tiring with complex movements or custom interpolations. Any way of doing it automatically? What would you do?

And for new animations, is it better to stick to non-target animation?

Any other tips regarding animating character sprites are appreciated (:
Last edited by Daxel on Thu Oct 14, 2021 9:33 am, edited 1 time in total.
User avatar
SimplSam
Posts: 1218
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: How to counter translation for game sprites?

Post by SimplSam »

[EDIT] I have just re-read this, and now reading as "I have existing 'normal' animations that I want to make sprite friendly - and the target bones are messing things up".

OK - So .. if the target bones were parented (relative) to the Root bone, then you could simply remove the translations in the Root and everything would play nice. But most target bones are not setup relative to Root, in fact it is normally quite the opposite.

So effectively we need to:
1) "Apply" Parenting to the Target Bone translations to make them relative to the Root Bone translation
2) Remove/Alter/Minimise the Root bone translations
3) "Apply" Unparenting to the Target Bone translations to make them global again

The apply Parenting/Unparenting needs to be done in a particular manner in order to make it work properly.
This can be done in script - as I had to do something similar in my Make Bones script. I will grab / retool the necessary code later.
Moho 14.3 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.3 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
Daxel
Posts: 1081
Joined: Wed Mar 27, 2019 8:34 pm

Re: How to counter translation for game sprites?

Post by Daxel »

SimplSam wrote: Thu Oct 14, 2021 3:37 am [EDIT] I have just re-read this, and now reading as "I have existing 'normal' animations that I want to make sprite friendly - and the target bones are messing things up".
I rephrased it to make it clearer sorry.

SimplSam wrote: Thu Oct 14, 2021 3:37 am OK - So .. if the target bones were parented (relative) to the Root bone, then you could simply remove the translations in the Root and everything would play nice. But most target bones are not setup relative to Root, in fact it is normally quite the opposite.
Yes, the legs targets are unparented to achieve the good old "stay on the floor while I move the body". The hands' targets are parented to a weapon that is parented to the body so the weapon will move with the character and the hands will move with the weapon.

SimplSam wrote: Thu Oct 14, 2021 3:37 am So effectively we need to:
1) "Apply" Parenting to the Target Bone translations to make them relative to the Root Bone translation
2) Remove/Alter/Minimise the Root bone translations
3) "Apply" Unparenting to the Target Bone translations to make them global again

The apply Parenting/Unparenting needs to be done in a particular manner in order to make it work properly.
This can be done in script - as I had to do something similar in my Make Bones script. I will grab / retool the necessary code later.
Oh that would be amazing. Thank you.
User avatar
SimplSam
Posts: 1218
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: How to counter translation for game sprites?

Post by SimplSam »

OK - We have a first release. The tool toggles the relationship between a bones translations (typically a target bone) and the "Root" bone. Allowing you to edit the translational transforms of the "Root" and maintain the positional relationship with relevant reparented bones, before setting them back to their original parental state.

Howto (typical use):
- Select one or more Target bones (can be any bone - but typically target & unparented)
- Click (run) the 'Toggle Parent Bone' tool: Attaches the selected bone to the "root" bone and adjusts transforms to make them relative
- (optionally) Review the new Parent relationship using the standard reparent bone tool
- Edit/Remove/Add any required "Root" bone Translations
- Click (run) the 'Toggle Parent Bone' tool: Dettaches the selected bone from the "root" bone and adjusts transforms to make them global
- Review your new animation

The tool (with more Notes) can be found in the Scripting forum: Toggle Parent Bone - A tool to toggle the relationship between a bones translations and root
or downloaded directly here: ss-moho-toggle-parent-bone.zip
Moho 14.3 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.3 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
Post Reply