Answers for "rigidbody2d addforce not working half the time"

C#
0

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);
Posted by: Guest on April-26-2021

Code answers related to "rigidbody2d addforce not working half the time"

C# Answers by Framework

Browse Popular Code Answers by Language