# Accessing the Rigidbody Component Through Scripts

## Overview

Rigidbody components can be [accessed like any other component](/unity-basics/select/components/accessing-attributes.md).

Example of storing the Rigidbody component in a variable:

```csharp
public Rigidbody thingRb;
```

In the Inspector, the object with the script attached will have the component for the script and this property:

![](/files/-MARoMtayV3E4FP8JvaT)

You can click and drag an object with a Rigidbody component into the field or click the circle target icon on the right to select from a list.

If you want to have Rigidbody component of the object the script is attached to be stored, use this script in the Start() function:

```csharp
thingRb = gameObject.GetComponent<Rigidbody>();
```

## Commonly Accessed Properties

Here are some example scripts to access the properties:

```csharp
// 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);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hopemoore.gitbook.io/unity-basics/physics/rigidbody-component/accessing-through-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
