- Home /
Currently working on a project what i am trying to achieve is when both cars bumper collide with eachother i want them to bounce back.
what i am trying to achieve is when both cars bumper collide with each other i want them to bounce back. And when the bumper collide with the body of the cars i want it to destroy that car.Both the cars having colliders and rigidbody..........
Answer by I5 · Sep 13, 2018 at 05:11 AM
Cool.
If the rigidbodies are NOT kinematic, set the collider physicsmaterial to have high bouncy'ness . It's quick and easy and will look cool.
In terms of destroying, you can use the OnCollisionEnter method in a script that's on the same game object as the rigidbody of the car. So, on collission, destroy that (or the other) car. If you want a delay after the crash and before the destroy, create and call a coroutine from OnCollisionEnter (but set a flag in OnCollisionEnter to prevent multiple calls on the coroutine.
i have done these steps but couldn't get success. Any alternative approach
try checking what layer each car is assigned to and then ensure that your physics/collision matrix allows them to interact. Also try tweaking the mass, drag (set to 0 to debug) and constraints of the rigidbodies. Hard to tell without screenshots of your inspector settings
Here is the screenshot of collider and rigidbody that i have applied on both the cars
Your answer
![](https://koobas.hobune.stream/wayback/20220612174518im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to create an application with "tracking objects without markers"? 0 Answers
** why does my Enum parameter goes back to default value? ** 1 Answer
How would I go about create multiple cursors controlled by multiple players 1 Answer