I have a car game where player drives a car; this car has a collider and a kinematic rigidbody attached and is completely controller by script (i.e. a script sets its position and rotation). In the game there are enemy cars which have the same setup.
However, when the player’s car collides with an enemy car I set the enemy car’s rigidbody to non-kinematic, apply some initial forces (to simulate the impact force and their previous velocities) and let the Unity physics simulate the collision. The player’s car remains under script control (its rigidbody is still kinematic).
This doesn’t give me realistic results, though. After collision enemy cars are pushed in front of the player’s car or are launched away or up in the air with vast forces (and I’m not using Random
, I always apply the same forces).
How should I setup my scene and use Unity physics to get a realistic collision behaviour? My colleague said that in Box2D
it was possible to set velocity
for the kinematic rigidbody and although it wasn’t affected by the physics engine it did interact with other rigidbodies like it weren’t kinematic, resulting in a realistic behaviour. In Unity I can’t set the velocity
for a kinematic rigidbody by maybe I can achieve this some other way?