unity addforce controller code example
Example: how to add force to character controller
... colliders = Physics.OverlapSphere (explosionPosition, explosionRadius); for (var hit in colliders) { if (hit.rigidbody){ // if it's a rigidbody, add explosion force: hit.rigidbody.AddExplosionForce(explosionPower, explosionPosition, explosionRadius, 3.0); } else { // but if it's a character with ImpactReceiver, add the impact: var script: ImpactReceiver = hit.transform.GetComponent(ImpactReceiver); if (script){ var dir = hit.transform.position - explosionPosition; var force = Mathf.Clamp(explosionPower/3, 0, 15); script.AddImpact(dir, force); } } } ...