Root Motion Animation System

For the love of god… Is there no one out there to help here :slight_smile:

I cant believe im stuck here… I have actually re-created almost the entire unity mecanim animation system except two (you would think real easy) calculations that need to be done on the interpolated keyframes from the Babylon.Animation track.

1… How to mirror a pose from the animation key frames.
- I want to be able to just use one left and right animation. I to serialize
one walk right animation and use is for walking right, also use if for walking left… Just
mirrored. How To Mirror Animation Key Frames

2… How to take the root bone position values from the animation key frames and use that as
delta movement to actually move the mesh transform node and not the skeleton root bone?

Here is the scenario:

1… I have a buffer to hold the last position vector (this._lastMotionPosition)
2… I am reading the root bone position vector key frame value from animation track (this._lastMotionPosition)

and finally a delta position vector buffer that is the difference of last position minus current position (this._deltaPosition)

on every frame i update these values like so:

if (this._lastMotionPosition == null) this._lastMotionPosition = this._rootMotionPosition.clone();    
this._rootMotionPosition.subtractToRef(this._lastMotionPosition, this._deltaPosition);
this._lastMotionPosition.addInPlace(this._deltaPosition);

and i can move the mesh transform node like so:

this.transform.position.addInPlaceFromFloats(deltaPosition.x, 0, deltaPosition.z);

The problem is when the animation loops… the transform position goes back to beginning instead of being additive

If its playing a walk forward animation the mesh transform node should just keep moving forward in the world… But it does not… it loop back to start because the deltaPosition goes back to start value…

I obviously am not doing the whole additive thing right…

Yo @Deltakosh … Or maybe @sebavan@PatrickRyan

Can one of guys please help me out…
How do I mirror key frame pose values ???

And

How do i turn these root bone key frame positions to additive delta movements i can use to actually move/translate the mesh/transform node ???

Thanks As Always
:slight_smile: