Addforce Unity 3d Code Example


Example 1: Rigidbody.addforce

using UnityEngine;public class ExampleClass : MonoBehaviour {     public float thrust = 1.0f;     public Rigidbody rb;    void Start()     {         rb = GetComponent<Rigidbody>();         rb.AddForce(0, 0, thrust, ForceMode.Impulse);     } }

Example 2: unity rigidbody addforce

rb = GetComponent<Rigidbody>(); rb.AddForce(new Vector3(1.5f,1.5f,1.5f));

Example 3: rb.addforce c#

rb.AddForce(0, 0, 5 * Time.deltaTime);  // Time.deltaTime is optional ( Make sure that "T" is caps)

Example 4: rb.addforce 3d c#

rb.AddForce(0, 0, 5 * time.deltaTime);  // time.deltaTime is optional

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable