Answers for "explosion physics in unity"

C#
1

explosion physics in unity

AddExplosionForce(float explosionForce, 
				Vector3 explosionPosition, 
                float explosionRadius, 
                float upwardsModifier = 0.0f, 
                ForceMode mode = ForceMode.Force));

// Example
public float power = 10.0F;
Vector3 explosionPos = transform.position;
public float radius = 5.0F;

Rigidbody rb = GetComponent<Rigidbody>();
if (rb != null) // Check if object have component "Rigidbody"
	rb.AddExplosionForce(power, explosionPos, radius, 3.0F);
Posted by: Guest on May-21-2021

C# Answers by Framework

Browse Popular Code Answers by Language