Hi, I want to achieve realistic impacts for characters, and using “Set Velocity” has proven being not really nice for that. I’ve seen I can get the Skeletal mesh component from the character and use “Add Force” on it, but even with very high amounts of force and different Bone Names of the mesh it’s not showing any effects. I’ve tried many types of collision for the character’s skeletal mesh and capsule, but nothing works. The “Add force” function is executed, as seen when debugging the character blueprint.
What’s preventing Add force to work in character’s skeletal mesh component? If there’s no solution, what would be the best way to achieve realistic impacts, collisions and physics for characters?
For forces to work, you’d need to enable simulation of physics for your skeletal mesh. That would, however, send it to physics mode, which means you no longer get animations. If you’re doing a full ragdoll effect, you can put the skeletal mesh in physics mode, and revert back to animations after the ragdoll effect times out (this will be VERY difficult to get right though). I also seem to remember that in UDK there was a way to set only a subset of the character’s bones to use physics simulation, though I don’t know if it’s possible in UE4. However, to get the best results with animated characters, you should use animations for small impacts (bullets and such) in which the character “winces”. If you still want to use physics, you must set the skeletal mesh’s “physics weight” to 1 to enable simulation of physics and then set it back to zero to switch back to animations.
That is a very helpful answer. But does that mean that in UE4 we can have either animations or physics with skeletal meshes, but not both at the same time? If that is true, how does one get collisions for an animated skeletal mesh?
You can have either animations or physics SIMULATION. Collision has nothing to do with it. Afaik, you can’t use PhysicsAsset’s for character movement (it wouldn’t make much sense either), but they can be used for traces, one-way interactions with the environment and such.
I see, thanks for your reply. So do I understand correctly that “normally” you have use the skeletal mesh with animations, even for projectile impacts or even death animations. And if you want, for a ragdoll effect for example, you can enable physics simulation, so that the physics asset takes over control. Is that correct?
Almost. For death, most games have some sort of animation which blends into a ragdoll half-way. This is consistent with how death really happens, since at some point along the way the brain ceases to send signals to the muscles and the body becomes a ragdoll (BTW, thinking of it like this makes you realize just how brutal video games have become). Old games sometimes did death with animations entirely, which made parts of the body stick into the ground or objects (Infamous 2 comes to mind as a recent example). However, if you look at Bloodborne for example, you’ll notice how the game blends between animation and ragdoll physics. Others have used entirely physics-based approaches (Doom 3 was like this if I recall correctly), but you’d need super powerful bullets which actually throw the enemy around if you want a neat-looking death.