Every Star Wars fan has dreamed of being a Jedi. But what is it about becoming a monk-like guardian of peace and justice that's so damn appealing? Sure, the lightsabers are cool, and those robes look ridiculously comfy, but we all know the real allure is getting to use the Force to lob stormtroopers around like bipedal putty.
Respawn was tasked with bringing that incredibly specific power fantasy to life with its latest release, Star Wars Jedi: Fallen Order. To do that, however, the dev team had to figure out how to make Force powers feel real. Grounding the mystical energy field in reality meant ensuring enemies reacted to it in a believable way. In short: when you hurl cannon fodder against at wall, they needed to sell it.
As explained by Respawn senior software engineer, Bartlomiej Waszak, during his GDC Summer talk, the studio looked to achieve that goal by employing physical animation techniques. Unlike regular animation, which simply sees an object or character cycle through a series of preset movements, physical animation incorporates rag doll physics into animation cycles to allow for more variety and interaction.
Waszak explained there are three main ways of driving physics to follow animations: either by using motors, velocities, or constraints.
"The first method is motors. The motor is part of the joint constraint between rag doll bodies, and they use a specified animation target to generate the local force between connected bodies, That local force drives bodies to follow the animation target," he said.
"The second method is using velocities. In this case we compute a velocity needed to move the body from one place to another during a given frame time. In this way we can force the body to reach the animation target.
"The third method is using constraints. In this instance, we would create a new constraint between the dynamic body of the rag doll and the animation target, and all parameters for this constraint define how we force the dynamic body to follow the animation target."
In Jedi: Fallen Order, the Respawn team used motors to add physical animation. The technique was useful for creating believable collisions between enemies and objects like crates and walls.
The was once instance, for example, where the team needed to ensure a death animation worked in confined spaces. It looked fine in wide open areas thanks to the use of rag doll physics towards the end of the animation, but in corridors or rooms where walls were present, limbs would often clip through objects as the enemy attempted to cycle to the final stages of that animation sequence.
In this case, the root body of a stormtrooper -- which is the 'hip body' highlighted in red above -- was trying to perform an acrobatic flip in a small area where it simply wasn't possible. The team still wanted that root body to move in the same way, but needed to stop it clipping as a result.
"The solution was to keep the hip body as a physically simulated body and create a new constraint for that body," continues Waszak. "That constraint is between the hip body and the given animation target. This new constraint drags the physics body of the hip bone to follow the animation target, and removes all degrees of freedom.
"The question was, with this new solution, what happens when we have an obstacle? So what happens when the hip body hits a wall and the animation target still pushed forward? What do we do about that physical body that's colliding with the wall?
"What we do is monitor the distance between the actual position of the hip body and the desired animation target. If the constant drive for that hip body is unable to hit the target within some threshold, we just switch to a free-fall rag doll mode."
Switching to a free-fall rag doll mode as soon as the hip body meets that threshold results in stormtroopers slumping into walls when flung backwards with the Force (as shown below). It instantly sells the power of abilities like 'Force push,' while preventing arms and legs from clipping through the environment.