- Home /
Make CharacterController act like rigidbody on explosions
I am making a first person shooter with a lot of melee combat, and one of the features I want is that a hard enough kick/punch can send a player/enemy flying back, smash them through walls terminator style etc. I want this to also happen from explosions, and from a non fatal sniper rifle hit- I was thinking that when a sniper shot hit you but did not kill you it could knock you on your back into a prone position, giving you a chance to escape behind cover.
Unfortunately, I can't find a way to even rotate a CharacterController, and as they are not rigidbodies the standard AddExplosionForce/AddForce functions won't work.
Please could someone tell me if it is possible to make character controllers rotate/be affected by forces, or whether I will have to use rigidbody characters.
Answer by Xtro · Aug 06, 2013 at 08:19 PM
Add rigidbody and character controller to the same gameobject. Disable the rigidbody by default.
In the explosion moment(maybe a little earlier) disable the controller and enable the rigidbody. When you detected it's landed, enable the controller and disable the rigidbody again.
Or you can use the ragdoll method. Which is all about having the exact copy of the character with a rigidbody instead of charactercontroller. In the explosion moment, you hide the real character and show the ragdoll copy of it.
Thank you, this helps a lot, I will probably use the ragdoll option for more realistic movement. I was thinking that the ragdoll would be visible at all times, but the rigidbodies would only be enabled on impact, and then disabled and somehow brought back into position by an animation.