mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-14 16:27:19 +00:00
explosion strength and upward modifier are proportional to squared root of vehicle's mass
This commit is contained in:
parent
8871702e5b
commit
b6b2037e97
1 changed files with 5 additions and 2 deletions
|
@ -190,9 +190,12 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
// create explosion effect
|
||||
|
||||
GameObject explosionGo = Object.Instantiate(VehicleManager.Instance.explosionPrefab, this.transform.position, this.transform.rotation);
|
||||
|
||||
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue