- Home /
Damage with collision force?
Hi! I'm trying to make my car take damage depending on the force and speed of the crash (both together)
But what happens is that if the car goes fast, regardless of THE FORCE of the collision, when it TOUCHES with any object, it ends up damaging, that is, it does not do so due to the force of the collision.
Does anyone know any little script that is used in the rigidbody to do this? (I use, collision.relativeVelocity.magnitude). Thank you!
@$$anonymous$$ Why do you use force and speed(velocity)? The calculation for the force(mass*acceleration) allready contains the velocity(a = Δv/Δt) . So if you want your damage to be dependend on the mass(not size) of colliding object, then you could use: float force=collision.impulse.magnitude/Time.FixedDeltaTime