need help guys,
make explosion script, but it not work.
i want, when player touch cube with collider as a Trigger then the Cube explode and player thrown,
this my script :
void OnTriggerEnter (Collision col)
{
ExplosionWork (col.contacts [0].point);
// please help me to change this to "Void OnTriggerEnter"
}
public void ExplosionWork(Vector3 explosionPoint)
{
hitColliders = Physics.OverlapSphere (explosionPoint, blastRadius, explosionLayers);
foreach (Collider hitCol in hitColliders)
{
if(hitCol.GetComponent<Rigidbody>())
{
hitCol.GetComponent<Rigidbody>().isKinematic = false;
hitCol.GetComponent<Rigidbody>().AddExplosionForce(explosionPower, explosionPoint, blastRadius, 0, ForceMode.Impulse);
}
}
}
Thanks, Have a nice day