"2d explosion unity" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "2d explosion unity" answered properly. Developers are finding an appropriate answer about 2d explosion unity related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like 2d explosion unity. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on 2d explosion unity.
2d explosion unity
using UnityEngine;
public static class Rigidbody2DExt {
public static void AddExplosionForce(this Rigidbody2D rb, float explosionForce, Vector2 explosionPosition, float explosionRadius, float upwardsModifier = 0.0F, ForceMode2D mode = ForceMode2D.Force) {
var explosionDir = rb.position - explosionPosition;
var explosionDistance = explosionDir.magnitude;
// Normalize without computing magnitude again
if (upwardsModifier == 0)
explosionDir /= explosionDistance;
else {
// From Rigidbody.AddExplosionForce doc:
// If you pass a non-zero value for the upwardsModifier parameter, the direction
// will be modified by subtracting that value from the Y component of the centre point.
explosionDir.y += upwardsModifier;
explosionDir.Normalize();
}
rb.AddForce(Mathf.Lerp(0, explosionForce, (1 - explosionDistance)) * explosionDir, mode);
}
}
Source: stackoverflow.com
All those coders who are working on the Whatever based application and are stuck on 2d explosion unity can get a collection of related answers to their query. Programmers need to enter their query on 2d explosion unity related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about 2d explosion unity for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of 2d explosion unity while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "2d explosion unity". Visit this developer's friendly online web community, CodeProZone, and get your queries like 2d explosion unity resolved professionally and stay updated to the latest Whatever updates.