Search code examples
unity-game-enginestandardsassets

Unity: Hit to another car without affecting my car


I'm newbe in Unity.I'm using Car and CarWaypointBased prefabs in Standard Assets package,to create a car racing game.

I want to make a situation to hit the CarWaypointBased object without affecting Car object( Like a car with super power!!).I mean ,it's as if my car was not hit (while makes another car to move).

Both have the default Colliders and Rigidbody.

Now collision causes both to move. I hope it was clear.

UPDATE

I use AddForce in OnTriggerEnter of my car:

other.GetComponentInParent<Rigidbody>().AddForce(-transform.forward * 500f ); 

And i set weight of my car on 10000, another to 500.


Solution

  • The easiest way to do it is to set the weights in rigidbody components. Set weight about a million to super_car and 1 or less to just a car. It will fly away after touching. The less the difference between weights is the less the lighter car will fly away. Just experiment with weights