I have a skeletal character that gets shot. I don’t really want to create hit animations for every different pose the character could be in.
As i know which bone received the hit i thought i could just apply a force to that rigid body to simulate a hit to that part of the skeleton. But this doesn’t seem to work. In fact i see no effect at all.
I’m wondering if the animation has priority over any force i apply to the rigid body? Has anyone experimented with something like this and had any luck?
Yes it’s for hit reactions when still alive. For example, a character standing idle gets hit by a bullet. I could blend a hit while stand idle animation and that would work fine, but if the character is getting up and hit then i’d need another hit animation for that and so on.
So i just wanted to be able to modify the joint rotation that got hit while an animation was playing. This way it’s more of a generic solution. But i’m not sure it’s possible due to the animation already playing on the character.
Yeah, you’d essentially have to pause the animation and manually apply the force to the joints. It’d end up having to be a walking ragdoll to do what you want it to do.
I have seen a lot of advanced programs do what’s called the “ragdoll switch” trick, though. Basically, you’d switch with the ragdoll for about a second, have that ragdoll crossfade from that position to a neutral one based on its position after the hit, and then switch back to the animation version. It’s still hard to do, but it’s easier than making an animation for everything.
You could solve this by either having additive animations for several hit positions, but the more complex/accurate you want the system, the more of these animations you will want to create.
What the other guys are talking about there is a continuous ragdoll system, and I assume by your name you are deving for the iPhone. This kind of system is probably going to be overkill for an iPhone game. Blurst’s game “Minotour in a China Shop” uses this kind of technology for the main character, and while their use of it is a little extreme (its there for more comedic purposes than realism purposes), it still shows a system like that is possible in Unity.
A good compromise would be to attempt a system that adds the animation for a ragdoll with your current animation, so the idea would be to kick in ragdoll just before the character gets shot, and add the motion from that with the current animation of the character. You would use a simple float to vary the amount of ragdoll to regular animation, and basically change that amount linearly once the impact has been made.
I won’t lie though, this is a complicated system, and systems like this have only been around for maybe 5 or so years, so making a few set animations for getting hit, and blending them in an additive way might be a better direction to take this, especially if you’re making this game for the iPhone.