Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity add explosion force

public void ApplyExplosionForce()
{
	float explosionForce = 50.0f;
	float affectedRadius = 15.0f;
	
	Collider[] colliders = Physics.OverlapSphere(transform.position, affectedRadius);
    
	foreach (Collider affectedObjects in colliders)
	{
        if (affectedObjects.TryGetComponent(out Rigidbody rigidbody))
	        rigidbody.AddExplosionForce(explosionForce, transform.position, affectedRadius, 1.0f, ForceMode.Impulse);
	}
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# how to get screen resolution in class 
Csharp :: unity get current scene 
Csharp :: c# mysql query 
Csharp :: c# length 2d array 
Csharp :: unity look at 2d 
Csharp :: remove all non number in c# 
Csharp :: check animation end unity 
Csharp :: unity android back button 
Csharp :: scenemanager c# 
Csharp :: isprime c# 
Csharp :: c# form formborderstyle none move 
Csharp :: get dropdown selected value unity 
Csharp :: c# get next item in list 
Csharp :: unity stop all audio 
Csharp :: keyboard input unity 
Csharp :: unity how to summon an object with code 
Csharp :: how to create a new folder with c# 
Csharp :: ef core dbfirst 
Csharp :: c# system.drawing.color to system.windows.media.color 
Csharp :: UnityEngine.Transform.get_position () (at <a0ef933b1aa54b668801ea864e4204fe:0) Gamekit3D.MeleeWeapon.BeginAttack (System.Boolean thowingAttack) 
Csharp :: check c# date for 0001/01/01 
Csharp :: how to log out of unity asset store 
Csharp :: make mesh follow wheel collider unity 
Csharp :: unity check if gameobject is active 
Csharp :: revitapi 
Csharp :: How can I cast string to enum? 
Csharp :: valid url in .net 
Csharp :: make an object disappear from a c# script unity 
Csharp :: get length of enum values 
Csharp :: traversing an enum c# 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =