hello spine team,
we want to use root motion for our next project but also do our own movement and collision checking.
to do so we only need something like a spine callback that tells us every animation update how much root motion it wants to apply without actually trying to apply it somehow.
i was able to achieve this by setting the Animation Update to "In Fixed Update", adding a fake Rigidbody2D component(disabled the "simulated" checkbox) and adding my own sub class of your SkeletonRootMotion component, that provides a root motion callback for other scripts:
public class SpineRootMotionTranslator : SkeletonRootMotion
{
public delegate void RootMotionUpdate(Vector2 displacement);
public event RootMotionUpdate OnRootMotionUpdate;
protected override void PhysicsUpdate(bool skeletonAnimationUsesFixedUpdate)
{
Vector2 rigidbodyDisplacement2D = new Vector2(this.rigidbodyDisplacement.x, this.rigidbodyDisplacement.y);
if (rigidbodyDisplacement2D != Vector2.zero)
{
if (this.OnRootMotionUpdate != null)
{
this.OnRootMotionUpdate(rigidbodyDisplacement2D);
}
}
this.previousRigidbodyRootMotion = this.rigidbodyDisplacement;
this.rigidbodyDisplacement = Vector2.zero;
}
}
This works really well for us but it's obviously just a hack to trick your code into thinking it applies root motion to a rigidbody.
And it is very likely to break once you make any changes to your code.
Can you please support something like this officially, so we will be able to update the spine integration in the future?