1. Unspottable
  2. News

Unspottable News

Unspottable: Blending ragdoll physics and animations

[h2]Blending Ragdoll physics and animation in Unity
[/h2]

This is a short techincal explanation of our system to blend between ragdoll physics and animation in unity 2019.
It came from the need of adding more robots to the scene by dropping them from the sky, so after being ragdolled on the floor they had to get back to an animated state:

[previewyoutube][/previewyoutube]

The ragdoll of the robots is fairly standard, they have an almost humanoid skeleton but not exactly.
It can be achieved on humanoid models following this great Brackeys video: https://www.youtube.com/watch?v=DInV-jHm9rk

Once ragdolled on the floor, the first step is to figure out if the robot fell on its front or back.
To do that we just compare the vector up of the root bone of our character and the default vector up.
Vector3.Dot(rootBone.up, Vector3.up) > 0

We're only focusing on two cases, up or down but that could be improve to have better animations to get up at different angles.

We can then choose between the two animations:



At that point, we want to blend between the positions of the ragdolled skeleton and the animation.
That's done by calculating the position and rotation of each bone, using their current ragdolled position and their supposed animation position.

So on LateUpdate() after the animation position is calculated:
To get the animated bone position, we have to look at the transform on LateUpdate, but for a real humanoid rig, it should be accessible using Animator.GetBoneTransform (https://docs.unity3d.com/ScriptReference/Animator.GetBoneTransform.html)

Interpolation of position and rotation for each bone, using a blendSpeed variable to be able to tweak the strenght of the blend:
foreach (Bones b in skeleton)
{
b.transform.position = Vector3.Lerp(b.transform.position, b.ragdolledBonePosition, blendSpeed);
b.transform.rotation = Quaternion.Slerp(b.transform.rotation, b.ragdolledBonePosition, blendSpeed);
}

I hope that short explanation helps some of you understand the logic, feel free to come and chat on twitter if you have questions!

https://twitter.com/unspottablegame
https://twitter.com/gwendle

And please wishlist on the store page to help us make more content! :)
https://store.steampowered.com/app/1243960/Unspottable/

Presenting Unspottable



GrosChevaux is a new indie game studio created by three long time friends.We've always dreamt of building games together and worked on many prototypes.

The idea for Unspottable came from a game of One Piece Unlimited Adventure on Wii. After what seemed like a bug to us in the 1v1 mode, we ended up fighting in a crowd of the same 10 characters, not knowing which one we were controlling.

We really enjoyed the experience of fighting without any indications on which character we were, nor on who our opponents were. We kept that idea in the back of our minds for 10 years!

We love some games using this hide'n'seek concept: Garry's mod Guess Who, SpyParty, Hidden in plain sight, Assassin's Creed Multiplayer mode. But we always wished more of this game were local multiplayer as that's our favorite type of gaming session!

We built on this basic concept of punching the other layers while hiding amongst AIs and create a lot of level prototypes with different rules and AIs to keep the gameplay accessible for everyone, interesting and competitive!

[previewyoutube][/previewyoutube]

[h3]What's next?[/h3]
We currently have a playable version with 4 levels and a few more in prototype that we are currently using in playtests.

Our goal is to have 15 levels at launch and then keep prototyping and coming up with fun new concepts after that! We're hoping to release by the end of the summer 2020.

In the meantime, drop us a line, we're doing some playtests in London and Paris.

You can also find us at EGX Rezzed 2020 on Thu 26 Mar – Sat 28 Mar!

And you can get all the updates here or on twitter: Twitter.com


Thanks