get rigidbody component unity code example
Example 1: get rigidbody component unity
Rigibody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
Example 2: way do we use a Rigidbody in Get.component();
using UnityEngine; using System.Collections; public class Test : MonoBehaviour { private Rigidbody rb; void Awake(){ rb = gameObject.GetComponent<Rigidbody>(); } private void Example() { rb.velocity = some value; } }
Example 3: unity rigid body variable
public Rigidbody rigidbody;
Example 4: unity rigidbody
private Rigidbody rigidbody