Hi
is it Possible to using rigidbody.AddExplosionForce to the objects without any coliders ?
i am using one the scripts in unity3d resources :
var explosionRadius = 5.0;
var explosionPower = 1000.0;
private var explosionDamage = 0;
var explosionTimeout = 2.0;
function Start () {
var explosionPosition = transform.position;
colliders = Physics.OverlapSphere (explosionPosition, explosionRadius);
for (var hit in colliders) {
if (hit.rigidbody)
hit.rigidbody.AddExplosionForce(explosionPower, explosionPosition, explosionRadius, 13.0);
}
if (particleEmitter) {
particleEmitter.emit = true;
yield WaitForSeconds(0.5);
particleEmitter.emit = false;
}
Destroy (gameObject, explosionTimeout);
}
but i don’t want using any colider !
is it Possible ? how ?
thanks
you don’t need a collider for AddForce, all you need is an object with a rigidbody.
But what you can’t do is use the sphere collision test to detect potential objects to apply it to
i think there is something wrong with my objects !!!
i import a fbx and give them a rigidbody but nothing happend !!!
no , i use this script and it didn’t add any forces to a Cube without coliders !!!
well how do you tell the object where it has to apply the force?
your code above relies on collision which you logically can not use without colliders.
the script is attach to another object !
i want to create something like explosion force ( grenade exp ) to add force to the other objects .
is it possible to do this without using colider ? how ?
thanks
it is, you have to loop through all objects in the scene.
So as you see: in the end you won’t get away cheaper than colliders.¨
but you could just as well just use the explosion framework on the website