rigid body 2d addforce code example

Example 1: rigidbody2d unfreeze position

public Rigidbody2D rb;

void Start()
{
	rb.constraints = RigidbodyConstraints2D.None;
}

Example 2: 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 3: unity rigidbody addforce

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