Accessing the Rigidbody Component Through Scripts
Last updated
Last updated
thingRb = gameObject.GetComponent<Rigidbody>();// Adds a force upward - great for making things jump (add a modifier)
thingRb.AddForce(new Vector3(0, 1.0F, 0));
// Turns off gravity for the item
thingRb.useGravity = false;
// Makes the item kinematic
thingRb.isKinematic = true;
// Update's the object's mass
thingRb.mass = 10;
// Resets the velocity and angular velocity - good for stopping moving objects
thingRb.velocity = new Vector3(0, 0, 0);
thingRb.angularVelocity = new Vector3(0, 0, 0);