Collider collides, triggers OnCollisionEnter, then bounces, before destroying itself

essentially i have a OnCollisionEnter function call Destroy on the object, yet the object is hitting and bouncing off of the collider it’s calling the OnCollisionEnter on… shouldn’t it be calling that as soon as it knows its going to bounce… and destroying itself before it has a chance to bounce away?

looking for a fix to this, before I am forced to switch over to ray/spherecasting

You can set the rigidbody kinematic to true for the object that just entered the trigger. Maybe you have to tweak your trigger area for this.

After posting this question, further research lead me to many questions about the same thing, but the one that clearly states my question is this, and as such, I will implement my own code to detect the collision before it happens… because OnCollisionEnter is called a frame later than it “should” be.

EDIT: here’s the code I implemented, basically a refactoring of the DontGoThroughThis.cs on the wiki.

//variables for raycasting in fixed updated
private float minimumExtent;
//private float partialExtent;
private float sqrMinimumExtent;
private Rigidbody myRigidbody;

//optimized declarations for fixedupdate
private float movementSqrMagnitude;
private Vector3 movementNextStep;
private float movementMagnitude;
private RaycastHit hitInfo;
Vector3 currentPosition = new Vector3();
Vector3 newPosition = new Vector3();
Vector3 nextPosition = new Vector3();

//initialize values 
void Awake() 
{ 
	myRigidbody = rigidbody; 
	minimumExtent = Mathf.Min(Mathf.Min(collider.bounds.extents.x, collider.bounds.extents.y), collider.bounds.extents.z); 
	//partialExtent = minimumExtent * (1.0f - skinWidth); 
	sqrMinimumExtent = minimumExtent * minimumExtent; 

	myRigidbody.velocity = transform.forward * SPEED;
	myRigidbody.angularVelocity = new Vector3(SPIN, SPIN, SPIN);
	
	Destroy(gameObject, timeToLive);
} 

void FixedUpdate() 
	{ 
		//have we moved more than our minimum extent? 
		currentPosition = myRigidbody.position;
		newPosition.x = currentPosition.x + myRigidbody.velocity.x * Time.deltaTime;
		newPosition.y = currentPosition.y + myRigidbody.velocity.y * Time.deltaTime - 0.5f * -9.81f * Time.deltaTime * Time.deltaTime;
		newPosition.z = currentPosition.z + myRigidbody.velocity.z * Time.deltaTime;
		//newVelocity.y = oldVelocity.y - gravity * timeDelta;
		nextPosition.x = newPosition.x + myRigidbody.velocity.x * Time.deltaTime;
		nextPosition.y = newPosition.y + myRigidbody.velocity.y * Time.deltaTime - 0.5f * -9.81f * Time.deltaTime * Time.deltaTime;
		nextPosition.z = newPosition.z + myRigidbody.velocity.z * Time.deltaTime;
		//nextVelocity.y = newVelocity.y - gravity * timeDelta;

		movementNextStep = nextPosition - newPosition; 
		movementSqrMagnitude = (nextPosition - currentPosition).sqrMagnitude;
		
		if (movementSqrMagnitude > sqrMinimumExtent) 
		{ 
			movementMagnitude = Mathf.Sqrt(movementSqrMagnitude); 

			//check for obstructions we will have hit
			//Debug.DrawLine (currentPosition, nextPosition);
			if (Physics.Raycast(currentPosition, movementNextStep, out hitInfo, movementMagnitude, layerMask.value)) {
				CustomOnCollisionEnter(hitInfo.collider);
			}
		} 
	}

	//For visual affects only. Actual collisions are calculated on the server.
	void CustomOnCollisionEnter(Collider colliderInfo)
	{
	    //Debug.Log ("CustomCollisionEnter hit at "+Time.time+" with"+colliderInfo.name);
	    if (hitSplatter != null) {
		    Instantiate (hitSplatter, transform.position, Quaternion.identity);
		    Destroy (gameObject);
	    }
	}