Closed HitsuSan closed 2 years ago
Update: In a build version i need to make it skip over 20 frames (after the action phase begins) before querying to stop getting the error.
Thanks for the info.
I think this is occuring because of blending. When the event is first triggered the animation isn't fully blended in yet. User tags are queried from the current pose of the most dominant (highest weight) animation so that is probably why it skips. In a build you are getting higher FPS so that kinda makes sense.
The solution I will probably implement is to add an option to get user tags from the chosen pose rather than dominant. Also potentially for user tag queries to always take it from the event animation during events.
Should be fixed in the next update.
Ok there's actually a few different things to consider here besides blending.
Firstly tags are assigned to poses. Once processed they don't occupy a time, they simply get applied to the poses within their range. This generally means that UserTags can't be more accurate than your PoseInterval.
With that in mind, the user tag is queried from the CurrentInterpolatedPose. How the UserTag is decided for that interpolated pose is based on how far in-between the two poses you currently are. If the interpolation value is below 0.5 then the user tag is taken from the 'before' pose' and if it is above 0.5 it is taken from the 'after' pose.
So in the meantime, I've added a new option to the MxMAnimator to allow the user to decide exactly how UserTags should be 'Blended'. The options are as follows:
This will be available in the next update coming mid November (potentially sooner on the github repo)
With that all said, If you are needing high accuracy, I don't think that UserTags are enough/aappropriate. Ultimately, I think a new type of tag may be necessary, one that triggers callbacks. However, this would obviously be a new feature that would take me some time to develop.
In the meantime you may want to consider curves which are are animation time dependent and not pose dependent. Alternatively you could even consider using Unity's in built event system.
I think for now I will close this particular item and add a new item for a 'callback tag' feature or something of the sort.
During the Action phase of an event with a user tag, the first 2 ticks any query can return the wrong user tag, after the 2nd tick it's always correct. This means that if i'm using tags for gameplay reasons and use a callback from mxm Event State Changed to look for the Action phase after i've initiated an Event and i query before skipping 2 ticks i can get the wrong tag (not sure if it's 100% of the time or less, it's definitely less after 1 tick and it's always correct after 2 ticks). (All of this was tested in VS + C# Callback wrappers)