# Create Simple Door

### Prepare your GameObject

{% hint style="danger" %}
To use Door System, you just have to add a SmartDoor Component on your GameObject. But you still have to respect the following contraints, required by design:

1. Create an Empty Object as Parent of your Door
2. Add SmartDoor component onto the Parent
3. Parent must have uniform scaling (1,1,1), (2,2,2), (3,3,3), etc...
   {% endhint %}

Here is what you should have now:

<figure><img src="/files/v8BQUaBLORE0GjcudmSE" alt=""><figcaption><p>SmartDoor and its child</p></figcaption></figure>

### Configure your SmartDoor

Once you have both, SmartDoor GameObject and its child, you can start configuring it.

#### Hinge Positioning

{% hint style="danger" %}
**Important Note:** DoorSystem relies on the GameObject's local forward direction to determine right and left.
{% endhint %}

In the process of setting up your door, you may encounter issues with the Hinge position, as illustrated below:

<figure><img src="/files/e4iv80VPfDy01vs5yIxx" alt=""><figcaption><p>Hinge positioning</p></figcaption></figure>

To correct the Hinge position, follow these steps:

1. Click on the "Bottom Right" button in the [Hinge section](/door-system-documentation/advanced/components/smartdoor.md#hinge-section) to adjust the Hinge position:

<figure><img src="/files/W0aB0eJrU0S3zeArNZXO" alt=""><figcaption></figcaption></figure>

After adjusting, you might find yourself in one of the following situations:

1. If the Hinge position is perfect, go to "Motion" step.
2. If the Hinge position is not ideal, follow the next steps.

#### Fine-Tuning the Hinge Position:

1. **Adjust Hinge Offset:**
   * Still in the [Hinge Section](/door-system-documentation/advanced/components/smartdoor.md#hinge-section), modify the "Hinge Offset" until the pivot point aligns perfectly with your door.
   * If your door had a well-positioned Pivot Point, you can restore it by clicking the "GFX Pivot Point" button instead of adjusting the offset.
2. **Recalculate Detection Area:**
   * After changing the Hinge position, remember to recalculate the [Detection Area](/door-system-documentation/advanced/components/smartdoor.md#detection-area-section) for accurate functionality.

<figure><img src="/files/hegye2M3YZGr00ZuJZNS" alt=""><figcaption></figcaption></figure>

By following these steps, you can ensure that the Hinge is correctly positioned, leading to smooth door animations and functionality.

#### Motion

By default, Door System opens doors with an angle of -90 degrees, which is suitable for [Right-Handled doors](/door-system-documentation/advanced/glossary.md#right-handled-door). However, for [Left-Handled doors](/door-system-documentation/advanced/glossary.md#left-handled-door), an angle of 90 degrees is recommended.

{% hint style="info" %}
**Why Use Negative Values for Left-Handled Doors?**

When defining the Open Angle, it's crucial to open the door in the Local Forward direction. This orientation assists Door System in correctly aligning the door based on the player's position. Special considerations may apply based on specific needs.&#x20;

{% endhint %}

<figure><img src="/files/rxxjdaCj9r05DwiZziFI" alt=""><figcaption><p>Open door in forwar direction</p></figcaption></figure>

To set the appropriate Open Angle:

1. Adjust the Open Angle to 90 degrees for Left-Handled Doors.
2. Click on "Use Open Angle as Open" to save your new angle.

#### Detection Area Configuration

By default, the Detection Area detects all GameObjects that enter. To filter them, utilize the "Layer Mask" or enable "Use Tag Mask."

Follow these steps:

1. Enable "Use Tag Mask" and select a Tag exclusively assigned to your Player.
2. Enable "Open On Detect" to allow the door to open upon detecting a GameObject with the specified Tag.
3. Click on "Calculate Detection Area" to finalize the settings.

Now, enter Play mode and move your character close to the door. You should observe the door magically opening in the Player's forward direction!


---

# 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://docs.cgpoly.io/door-system-documentation/general/getting-started/create-simple-door.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.
