explosion strength and upward modifier are proportional to squared root of vehicle's mass

This commit is contained in:
in0finite 2020-06-22 03:05:42 +02:00
parent 8871702e5b
commit b6b2037e97

View file

@ -192,7 +192,10 @@ namespace SanAndreasUnity.Behaviours.Vehicles
GameObject explosionGo = Object.Instantiate(VehicleManager.Instance.explosionPrefab, this.transform.position, this.transform.rotation); GameObject explosionGo = Object.Instantiate(VehicleManager.Instance.explosionPrefab, this.transform.position, this.transform.rotation);
// modify strength of explosion based on vehicle mass // modify strength of explosion based on vehicle mass
explosionGo.GetComponentOrThrow<ExplosionPhysicsForce>().explosionForce *= this.HandlingData.Mass / 1500f; float forceFactor = Mathf.Sqrt(this.HandlingData.Mass) / Mathf.Sqrt(1500f);
var physicsForce = explosionGo.GetComponentOrThrow<ExplosionPhysicsForce>();
physicsForce.explosionForce *= forceFactor;
physicsForce.upwardsModifier *= forceFactor;
} }