Basic motion matching system for player movement animations

hello, i have made basic motion matching vaguely similar to what ubisoft uses.

ive not seen anyone really attempt this before (mainly because Roblox’s animations are terrible for anything procedural animation related and root-motion related :joy:) so i decided to have a crack at it.


Without getting too deep into it, what motion matching does is it takes your player’s movement trajectory and some data about your current players pose, and then chooses a pose out of a big list of mocap data that makes the most sense to go next. (its a bit confusing)

For instance, if you are running forward and then decide to turn left, this system is able to look through the mocap data and find the “turn left” part, and then choose which pose makes the most sense to be used next.

This allows for nice looking animation with minimal foot-sliding to the standard of what you can get with root-motion, but with way more responsive controls.

The great thing about this system is that it uses no state machines! no need to mess around with :AdjustWeight() on a billion animations at once! With motion matching, you can quite literally just throw mocap data at it, and it will figure out how to play the animation itself. Of course, getting a large amount of high quality mocap data is indeed a bit difficult, but once you get it, its smooth sailing from there.

but yeah, this is nerd stuff. I thought it was cool so maybe someone else will too :joy:

here it is. This uses a single Roblox animation, and again, uses no state machines of any kind.

and here’s a little bit of it in action

Obviously, its a bit rough, and is again still very basic (im only using about 16 seconds of mocap data here, which is nowhere near enough), but still definitely is better than a single looping run animation that we usually see in roblox games, and i can definately see potential for this becoming close to what AAA game companies can come up with.

(i especially like the detail where the player takes an extra step when turning, gives alot of life to it)

Although, a big problem ive found is with Roblox animations themselves. Roblox currently has no way to query AnimationTracks for single frame data, so right now im having to set the TimePosition, and then wait a frame for the animation to update, so when prepping mocap data, the system has to take a long while to go through the entire animation to create pose data and trajectory data for the motion matching to use. (can take up to 5+ minutes, depending on how long the animation is)
This definitely isnt ideal, since this sort of thing depends on a large amount of mocap
to pick from so that it looks the best it can. The more data, the better result.

i hope for the day that Roblox decides to upgrade animation functionality, so that we can actually do all these kinds of things easier :sob:

but yeah, cool stuff. hope to use this in my game someday if i can flesh this out.
thanks for reading


heres a GDC talk if you wanna learn about the details of something like this.

36 Likes

Just wow, Hedrows 2 is literally on the level of AAA. Last time I was able to play test it, it already felt AAA but now its just getting even further.

4 Likes

One of the most impressive things i’ve seen on roblox,keep up the good work !

1 Like

this is brilliant.
keep it up, people like you are what keep engines so far behind filled with lazy developers, back to the front on the top with… innovation

How’d you achieve predicting what animation should be used? Very curious!

This is impressive, Good job!
Although i’m very curious on how you get the mocap data for the animation, I tried some stuff but it didn’t work out as expected.

1 Like