I am working on a project(Racing car). When it hit an object the object should be destroyed. The Object is being destroyed when it is hit, but the car stops for a moment after hitting like an obstacle. How can I make this smooth, like the object is there and it is destroyed on collision but the car moves with the same speed?

Script attached to the object:

void OnCollisionEnter(Collision col){

    Destroy (gameObject);


Nothing needs to stop or slow down. It doesn't need to exert any physical force.


  • \$\begingroup\$ Does anything in your game need to slow down or stop when it hits these objects? Or is it OK if the objects exert no physics influence on stuff that collides with them? \$\endgroup\$ – DMGregory Jul 4 '18 at 20:00

On the objects that are to be destroyed on collisions, set isTrigger to true on the collider component. Then use OnTriggerEnter(Collider other) instead of OnCollisionEnter().

Triggers still detect collisions, but allow rigidbodies to move through them freely.

The one downside I've run into with this method is it's more difficult to figure out exactly where the point of collision was (since now you're only given a Collider instead of a Collision, but it looks like this won't matter for your situation.

  • \$\begingroup\$ No problem. Please accept it as the answer if it solved your problem. \$\endgroup\$ – Adam Stox Jul 5 '18 at 2:13
  • \$\begingroup\$ As a posible solution on the collision point problem, you could reduce the rigidbody weight to a miniscule amount (like mathf.epsilon) and still use a collision. It would be kind of hacky, but it would probably work. \$\endgroup\$ – Adrian Sgro Jul 5 '18 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.