Hi all,
I’m making a sprite-based 2D game that is very animation intensive. Animations can alter game properties (e.g. make character immune to projectile damage from 0.3s to 0.8s in the move), alter trigger colliders (e.g. where on the body a hitbox can make contact), and alter transform.position.
The first two are easy enough with animated properties as in Unity - Manual: Using the Animation view
The last one has been less obvious. It seems like a case for root motion, but I can’t find any documentation for using it with sprites. Some solutions I’ve seen involve adding an empty parent to the object, but that snaps them back to local 0,0 at the end of the animation.
For an example, look at Fei Long’s Rekka Ken animation from Super Street Fighter 2 that I’ve attached to the post. Sub-sprites 2, 4, and 7 are when he advances forward with a punch. If I change his position via script and store that data in a ScriptableObject, that means somebody needs to remember to adjust that every time an animator changes sprite keyframe timings. This also means that I have to duplicate the work of features like easing curves in a separate script.
Can anyone suggest any solutions that will:
-
Animate relative to the current position. This rules out animated properties the way I’ve been doing, as that puts them at absolute positions.
-
Maintain the ending position after the animation finishes. This rules out the empty parent solution.
-
Synchronize these transform.position changes with the animation. Ideally, this means changes to position are stored in the animation itself, so we don’t have to audit other data files.
Thanks!
