Explosion Force Issues

I seem to be having a few issues with getting “rigidbody.AddExplosionForce” to work.

I am making a basic Pinball game and I have the following script attached to the ball:

using UnityEngine;
using System.Collections;

public class DeflectorBounce : MonoBehaviour {
	
	public float force = 0.0f;
	public float radius = 0.0f;

	void OnCollisionEnter (Collision collision){
		
		if (collision.gameObject.tag == "Deflector"){
		    rigidbody.AddExplosionForce (force, transform.position, radius);
		    Debug.Log ("Bounce");
		}
	}
}

What this is supposed to do is detect a collision with a deflector, then add an explosion force to propel the ball.
I have tried everything I can think of, but I still cannot get the explosion force to work. I have even used the example in the scripting reference… that didn’t work either.

Even code that works perfectly in another project does not work here.

If anyone has any suggestions they would be greatly appreciated.

Bump

Bump 02

Are you getting the debug?

Yes I am.

Isn’t there supposed to be a 4th parameter in the argument - upwardsModifier? Maybe it’s optional. Do you get any errors in the console?

The 4th parameter is optional, and I am not getting any errors in the console.
What is confusing me the most is that even the code in the documentation isn’t doing anything either.
And this isn’t the first time I have used the function. I have used it in several other projects and it worked fine.

Another Bump

some ideas: did you try excessive high values for force? is the radius large enough? what are the values if you log the rigidbodies velocity in fixedupdate? is your rigidbody set to kinematic? is the rigidbodies velocity somehow modified in the same frame? is something unusual in your physics settings?

  1. Yes.
  2. Well and truly.
  3. I will check that sometime tomorrow.
  4. No.
  5. Shouldn’t be.
  6. Unity default.

Thanks everyone for your help, but I think I will just postpone the project for now. The deflectors are proving to be too much hastle.