# Create Firearm

## Create Firearms

A **Reality Firearm** is a specialized **child class** of [Reality Interactable](/realitysdk/documentation/interactable/create-interactable.md) designed for VR weapons.

It includes built-in grabbing, aiming, firing, and physics. The `RealityFirearm` class lets you build \~90% of weapons out of the box and is modular enough for the remaining 10%.

Video Guide: <https://youtu.be/quGQp6CJZ1s>

***

### Creating a Reality Firearm Actor (from scratch)

{% stepper %}
{% step %}

### Create the Blueprint

* Right-click in the **Content Browser** → **Create Blueprint Class**.
* Search for **RealityFirearm** and choose it as the **parent class**.
  {% endstep %}

{% step %}

### Customize the Blueprint

* Open the Blueprint and customize components, visuals, and behavior.
  {% endstep %}

{% step %}

### Assign Data

* Assign the **Data** variable to a **RealityFirearmData** asset in the details panel.
  * You will get errors without this.
    {% endstep %}

{% step %}

### Configure Behavior

You’ll configure behavior via three systems in the Data Asset: **Feeding**, **Chambering**, and **Firing**.
{% endstep %}
{% endstepper %}

***

### Faster Start: Duplicate an Example (recommended)

{% stepper %}
{% step %}

* Enable **Show Engine Content** (Content Browser → **Settings**).
  {% endstep %}

{% step %}

* Browse the Reality Content plugin library (e.g., `Library/Interactable/Firearm`).
  {% endstep %}

{% step %}

* Duplicate an example firearm (e.g., **AK-47**) and its **Data Asset**.
  {% endstep %}

{% step %}

* Rename (e.g., `BP_Firearm_M16`, `DA_Firearm_M16`).
  {% endstep %}

{% step %}

* Move both into your mod’s **folder** (Plugins → your mod).
  {% endstep %}

{% step %}

* In the **class defaults** of the new firearm, search for **Data** and assign your new data asset there.
  {% endstep %}
  {% endstepper %}

{% hint style="warning" %}
Assets **outside** your mod’s `ModName Content` folder will **not be packaged**.
{% endhint %}

***

### Grip Auto-Registration

`RealityFirearm` registers the following grips:

* **Charging Handle Grip** → **Animated Grip**
* **Main Grip** → **Animated Grip**
* **Main Mesh** → **Procedural Grip**

{% hint style="info" %}
To disable an inherited animated grip, set its collision volume bounds to **zero** (e.g., the charging handle on the Sawed-Off Double Barrel).
{% endhint %}

***

### Viewing Example Firearms

Find example Blueprints such as:

* `RealityFirearm_AK47_Example`
* `RealityFirearmDoubleBarrelSawedOff_Example`
* `RealityFirearm_Revolver_Magnum_Example`

These are excellent references for setup and modularity. They also show broader variations—e.g., the **Revolver** class extends the firearm system with a **physics-based spinning cylinder**.

***

### Assemble Your Firearm (component pass)

After duplicating an example, swap meshes and place helpers:

* **Base Mesh** → your weapon body.
* **Main Grip & Collision** → align to the pistol grip.
* **Charging Handle Mesh** → set mesh, position as needed.
* **Charging Handle Grip & Collision** → place grip and collision where hands should grab.
* **Bolt Mesh** → set and position mesh (supports **decoupled** bolt).
  * **Chamber Round Mesh** → at bolt top (shows chambered round).
* **Distance Grip Indicator** → typical at the pistol grip.
* **Firing Location** → set position at muzzle.
* **Firing Mode Selector Mesh** → set mesh and position.
* **Round Ejection Transform** → position at ejection port.
* **Chamber Smoke Transform** → position at chamber/ejection area.
* **Trigger Mesh** → set and align.
* **Recoil Target** → where recoil force gets applied to the weapon, usually placed slightly above the weapon (tune by testing).
* **Action Release Button (Bolt Catch)** → closes the bolt when the collision is hit.
  * **Mesh** position at desired location
  * **Button Collision** set size and location.
* **Round Insertion Collision** → For applicable weapons, the location where rounds are manually inserted into the chamber or internal magazine

Remove irrelevant example components (e.g., AK-specific bits) to keep things clean.

{% hint style="info" %}
When aligning **Grips**, set the root location correctly for both the left and right hands. Ensure proper positioning by setting the correct blend space asset.
{% endhint %}

***

## Magazine & Guiding Spline (summary)

For weapons with external magazines, place a **Magazine Insertion Collision** at the magwell and add a **Magazine Guiding Movement Spline** to define the insertion path. The firearm will use overlap checks between its insertion collision and the magazine’s insertion collision to begin guiding and seating the magazine.

For full instructions (helper mesh workflow, magazine BP/data setup, and the Instanced Round Mechanism), see the dedicated Magazine Guide: [**Magazine Guide — Magazine & Guiding Spline, Magazines, and ISM Rounds**](/realitysdk/documentation/interactable/firearm/create-magazine.md).

***

### Link the Firearm to Its Data Asset

In the firearm BP → **Class Defaults → Type Data**, assign your firearm **Data Asset** (e.g., `DA_Firearm_M16`).

All tuning happens here, grouped into **Feeding**, **Chambering**, **Firing**.

***

### Firearm Input (Data Asset)

* **Input mapping**
  * **Action 1 (Trigger)** → Typically set to Fire
  * **Action 2 (A/X depending on controller)** → Typically set to Release Magazine
  * **Action 3 (B/Circle depending on controller)** → Custom (e.g., **Change Firing Mode**, or **Action Release** on some pistols)

***

### Firing System (Data Asset)

This system handles trigger behavior, fire rate, recoil, and visual/audio effects.

* **Fire Rate** (seconds between shots)
* **Damage**
* **Trigger Max Rotation** (measure on your trigger mesh; enter positive degrees)

Audio:

* **Firing Sound**
* Optional:
  * **Firing Distance Sound**
  * **Firing Loop Sound** (for automatic weapons; falls back to **Firing Sound**)
  * **Firing Loop Distance Sound**
  * **Firing Stop Tail Sound** with **Start Delay**
  * **Firing Dry Sound** (no rounds)
  * **Firing Dry Cocked Sound**
  * **Firing Safe Sound**

VFX:

* **Firing Muzzle Flash** (default) — can set overrides for burst/automatic
* **Chamber Smoke on Fire** (spawns at **Chamber Smoke Transform**)

Recoil:

* **Force Vertical**
* **Force Vertical Two Hands Multiplier**
* **Recoil Force Back**
* **Recoil Force Back Two Hands Multiplier**

Firing Modes:

* Add modes (e.g., **Automatic**, **Semi-Automatic**, **Safe**).
  * **Array order sets default mode** (first = active on start).
* **Burst Fire Shot Amount** (if using Burst).
* Selector:
  * **Selector Animations** (thumb animation montages)
  * **Logic Delays** (sync to thumb contact)
  * **Selector Rotations** → set per mode to match your selector component.
* **SFX**

***

### Chambering System (Data Asset)

This system manages the bolt, charging handle, and round ejection behavior.

> Disabling features removes related components at runtime to save performance

Charging Handle:

* **Enabled**
* **Max Pull Distance**
* **Distance to Chamber New Round**
* **Can Release Charging Handle by Partial Pull Motion** (primarily for pistols)
  * When true, allows the player to release the slide/charging-handle by performing a partial rearward pull and releasing (a short “nudge” or slingshot) to let the bolt/slide snap forward
  * When false, the player must either fully rack the charging handle or press the slide release/bolt catch.
* **Slides Back on Fire**
* **Hold Charging Handle Retracted on Last Round Fired**

Decoupled Bolt:

* **Bolt Slide-Back Distance on Fire** → set rearward travel when firing.

Turn Bolt (bolt-action primarily for snipers):

* **Turn Bolt Max Angle** before pull.

Action Release Button (Bolt Catch):

* **Has Action Release Button**
* **Can Hit Action Release Button**
* Optional **Delta Location/Rotation after Lock-Back**
* Optional **Thumb Animation** (if the button is reachable from the pistol grip hand)
* **SFX**
* **Press Logic Delay**

Round Ejection:

* **Eject From Chamber on Firing** → enabled/disabled (uses the **Round Ejection Transform** component)
* **Ejection/collision SFX**
* **VFX** (Niagara particle system representing a full/consumed round)

***

### Feeding System (Data Asset)

This system controls how ammunition enters the weapon (magazines, internal stores, manual loading).

* **Has External Magazine** → enable for detachable mags.
* **Compatible Magazine Classes** → add your magazine class (children of a base class are supported).
* **Force Hand Release on Magazine Clipping** → optional auto-release on seat.
* **SFX** → optional clip/release sounds.

Internal Magazine (primarily for shotguns/snipers):

* set enabled/disabled
* set magazine capacity

Manual Round Insertion:

* set enabled/disabled
* set **Compatible Round Class**
* set SFX

***

### Gameplay (Data Asset)

* **Abilities** → ensure the firearm has **Firearm Fire Ability** (required; GAS/multiplayer).

***

### Scaling Interactables

{% hint style="warning" %}
Do **not** scale the **Root Component**. Scaling the root causes physics issues.
{% endhint %}

Use UE tools instead:

* Re-model/re-import at the correct scale, or
* Adjust **Import Scale** in the **Static Mesh Editor**.


---

# 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://beyond-sandbox.gitbook.io/realitysdk/documentation/interactable/firearm/create-firearm.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.
