Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

rigidbody.addforce not working

//Even though Unity says that transform.forward = Vector3(0, 0, 1) that is not the case

//This is the line that you want
gameObject.GetComponentOfType<Rigidbody>().AddForce(transform.forward * 200,ForceMode.Impulse);;

//This line will give you seemingly random values
gameObject.GetComponentOfType<Rigidbody>(). AddForce(new Vector3(0, 0, 200, ForceMode.Impulse);
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# chunk array 
Csharp :: get appsettings from app.config c# .net core 
Csharp :: c# remove substring 
Csharp :: vb.net get date minus one day 
Csharp :: remove last instance of string c# 
Csharp :: c# get witdh of matrix 
Csharp :: recursively reverse linked list 
Csharp :: what is list in c# 
Csharp :: c# get date without time 
Csharp :: declare string array c# without size 
Csharp :: unity initialize array 
Csharp :: c# loop string 
Csharp :: delete all rows from table mvc 
Csharp :: c# unit test for throwing exception method 
Csharp :: new list/array with values c# 
Csharp :: unity rb.addexplosionforce 2d 
Csharp :: how to use buildcontext in initstate flutter 
Csharp :: httpclient 
Csharp :: c# callback param 
Csharp :: c# get random between 0 and 1 
Csharp :: unity scene switch 
Csharp :: start a particle effect when a button is pushed 
Csharp :: regular expression alphanumeric dash space c# 
Csharp :: how to serialize a property in unity 
Csharp :: unity basic public options 
Csharp :: get gameobject active state 
Csharp :: guicontrol text ahk 
Csharp :: find gameobject by name in root 
Csharp :: get file upload file size in MB c# 
Csharp :: lwjgl fullscreen 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =