Reader small image

You're reading from  Unity 5.x Animation Cookbook

Product typeBook
Published inMay 2016
Reading LevelExpert
PublisherPackt
ISBN-139781785883910
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Maciej Szczesnik
Maciej Szczesnik
author image
Maciej Szczesnik

Not interested. Too busy with current game project. Source: Linkedin.
Read more about Maciej Szczesnik

Right arrow

Applying force to a ragdoll


In this recipe, we are going to apply some additional force to a ragdoll when we turn it on. Normally, when you turn the ragdoll on, it starts from idle; no initial movement is introduced. It looks stiff and unnatural. Applying force to a body part will help to avoid that.

Getting ready

We are going to use the same character as in the Creating a humanoid ragdoll with the ragdoll wizard recipe. We will also use the HandleRagdoll.cs script from the same recipe to turn the ragdoll on. You can also open the example Unity project and go to the Chapter 09 Physics and animations\Recipe 06 Applying force to a ragdoll directory. If you open the Example.unity scene there and play the game, you will be able to click on any body part of the character. That will turn the ragdoll on and apply force to this body part, which will make the character look like it was hit or shot in that particular limb:

Force applied directly to the head of the character

How to do it...

To apply force...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity 5.x Animation Cookbook
Published in: May 2016Publisher: PacktISBN-13: 9781785883910

Author (1)

author image
Maciej Szczesnik

Not interested. Too busy with current game project. Source: Linkedin.
Read more about Maciej Szczesnik