Colliders Not Doing Their Job

So I have a pretty annoying problem.

I’ve been using the FPS Constructor Weapons Package V 0.95 to throw some weapons together really quick, however, one weapon in particular, the rocket launcher, is not behaving like I would want it to.

Basically the rocket only hits the surface of my boxcollider-based floor about 80% of the time, and only hits my meshcollider-based surfaces about 10% of the time. Now I’ve heard about how mesh colliders can be worse for fast traveling rigidbodys etc. but I certainly am not going to manually put primitive colliders into my ENTIRE map.

I’ve heard of solutions to this “quantum tunneling” problem, that include raycasting and other techniques but I really have no idea where to start on this. Any input is welcome.

Here is the related script for the grenade/rocket function:

grenade.js

var delay = 1.0;
var timeOut = 1.0;
var detachChildren = false;
var explosion : Transform;
var explodeAfterBounce : boolean = false;
private var hasCollided : boolean = false;
private var explodeTime : float;
//private var hasExploded : boolean = false;

function Start (){
explodeTime = Time.time+timeOut;
}

function OnCollisionEnter (collision : Collision){
	if(hasCollided || !explodeAfterBounce)
		DestroyNow();
	yield new WaitForSeconds(delay);
	hasCollided = true;

}
function DestroyNow ()
{
//	if(hasCollided){
		if (detachChildren) {
			transform.DetachChildren ();
		}
		DestroyObject (gameObject);
		if (explosion)
			Instantiate (explosion, transform.position, transform.rotation);
//	} else {
//		return;
//	}

}
function Update () {
   var direction = transform.TransformDirection(Vector3.forward);
   var hit : RaycastHit;
   if(Time.time > explodeTime){
   	DestroyNow();
   }
}

Thanks for all the help!

~TacoShank

Use continuous dynamic for the collision detection instead of discrete. And/or increase the rate at which physics runs in the time settings; by default it’s 50fps (.02).

You can set up so that when the distance between a rocket and an object with a wall tags is less than 1 unit away, have it detonate.