Greybeard
0
Q:

unity rigidbody addforce

public Rigidbody rb; //make reference in Unity Inspector

public float SpeedX = 0.1f;
public float SpeedY = 0.5f;

rb.AddForce(new Vector2(SpeedX, SpeedY));
5
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);
    }
}
6
rb = GetComponent<Rigidbody>();
rb.AddForce(new Vector3(1.5f,1.5f,1.5f));
7

New to Communities?

Join the community