godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Add an animation node that will mirror animation on a skeleton #8007

Open RonYanDaik opened 11 months ago

RonYanDaik commented 11 months ago

Describe the project you are working on

A 3D game with fighting animations.

Describe the problem or limitation you are having in your project

I would like to use one punching animation for both hands but don't want to create 2x copies of same animation but for opposite part.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

An animation node that you can add to the animation tree.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Adding a node that will seek through skeleton bones with same name and suffix _L _R and swap animation data between mirrored bones.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I couldn't find a way to achieve this with script. (Maybe I could swap animation tracks names? I'm not sure.)

Is there a reason why this should be core and not an add-on in the asset library?

It additional node that improves quality of life.

Mickeon commented 11 months ago

This sounds very situational and it could probably be done with an addon with the right knownledge.

RonYanDaik commented 11 months ago

This sounds very situational

Idk. Every project I've been working on I thought that something like this would be very very handy.

fire commented 11 months ago

I think creating a feature enhancement for this is possible if you're ok with using the godot humanoid profile. Are you ok with that?

Illauriel commented 10 months ago

Chiming in, because I need this feature in my project too, and wanted to write a similar proposal.

I think creating a feature enhancement for this is possible if you're ok with using the godot humanoid profile. Are you ok with that?

I'd actually love that! Not necessarily as an animation node, but maybe as a flag somewhere in the BoneMap, as it only relates to laterally symmetrical armatures.

I could think of at least a few more use-cases in context of animated 3d games:

As for "why not have it as an add-on", an argument like "Unity and Unreal have it out of the box" might not be the best, but they do. Coming from Unity background, I've spent considerable time looking for a way to do this in Godot without resorting to hacks or "just making flipped copies of everything", and turned out it just doesn't exist for now.

TL;DR: It's a pretty rare use case, but if it comes up, this enhancement would save users a ton of effort.

PS: I propose renaming this issue to "Adding means to mirror animations on symmetrical 3D skeletons" or something and adding an enhancement label.

lyuma commented 10 months ago

@jmarceno I'm not sure the approach of negating X scale was intended to be a serious suggestion or not, but it brings a particular comic to mind... (http://www.mspaintadventures.com/newindex.php?s=6&p=003200)

For some specific games with perfectly symmetrical art, it could work as a workaround, but sprite flipping, as it were, is simply not acceptable as a general purpose solution for this problem.

Personally I agree completely with @Illauriel that this deserves to be solved at the engine level. At a minimum, there should be a reasonable workflow/pipeline for creating such mirrored animation that doesn't involve manually flipping animations or assets. Personally, I can see this being helpful for creating walk cycles such as sideways motion without needing to create double the number of animations for left and right.