> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinemation.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations: FPS Animation Pack and Custom Setups

> Integrate the FPS Animation Pack with CAS for 20 ready-made weapons and learn how to use the Character Skeleton API for custom animation tool integrations.

CAS is designed to integrate with external animation packs and your own tooling. The most feature-complete integration available is the **FPS Animation Pack × CAS** package, which bundles 20 fully animated weapons, FPS arms, and weapon audio — all pre-wired to work with the Character Animation System out of the box. For projects building custom tools or procedural systems, the **Character Skeleton API** provides programmatic access to the full bone hierarchy at runtime.

## FPS Animation Pack Integration

The **FPS Animation Pack × CAS** integration combines the FPS Animation Ultimate asset with the CAS runtime. You get 20 ready-made weapons with idle, fire, reload, ADS, and inspect animations — plus camera shake assets for recoil — all configured to slot directly into CAS settings and prefabs.

<Tip>
  Join the [Kinemation Discord](https://discord.gg/kinemation-1027338787958816860), verify your purchase, and you will gain access to the integration package download in the members channel.
</Tip>

### Installation

Follow all four steps in order. Skipping or reordering them will cause missing script references or import errors.

<Steps>
  <Step title="Import CAS including demo content">
    Import the **Character Animation System** package from the Unity Asset Store into your project. When prompted, also import the **CAS demo content** package so that all base prefabs, settings, and scripts are present before you add the integration layer.
  </Step>

  <Step title="Import FPS Addon including FPS demo content">
    Import the **FPS Addon** package. Again, include the **FPS demo content** so that the shared input assets and prefab dependencies resolve correctly.
  </Step>

  <Step title="Import FPS Animation Ultimate (FPSAnimationPack folder only)">
    Import the **FPS Animation Ultimate** asset from the Asset Store. In the import dialog, select **only the `FPSAnimationPack` folder** and click **Import**. Do not import the root-level demo scenes or example scripts from this package, as they are not compatible with the CAS integration layer.

    <Warning>
      Importing content outside the `FPSAnimationPack` folder from FPS Animation Ultimate can introduce script conflicts. Select only that folder during import.
    </Warning>
  </Step>

  <Step title="Import the integration package">
    Download the latest version of the **FPS Animation Pack × CAS** integration package from Discord and import it into your project. Click **Import** to accept all assets in the package.
  </Step>
</Steps>

### Built-In / HDRP Upgrade

All materials in the FPS Animation Pack are set up for **URP** by default. If your project targets Built-in or HDRP, upgrade the materials before entering Play Mode:

1. Navigate to `KINEMATION/FPSAnimationPack/RenderPipelineUpgrades` in the Project window.
2. Select the upgrade package matching your render pipeline (`BuiltIn_Upgrade` or `HDRP_Upgrade`).
3. Double-click the package to apply the material upgrades.

### Content Structure

After installation, the integration content lives under `KINEMATION/FPSAnimationPack/`. The folder is organized as follows:

<CardGroup cols={2}>
  <Card title="Animations" icon="film">
    Animation Assets for all character and weapon clips, along with custom Avatar Masks and Animator Controllers. Each weapon has a dedicated subfolder containing its idle, fire, reload, ADS, inspect, and equip clips.
  </Card>

  <Card title="Camera Shakes" icon="camera">
    CameraShake assets for every weapon's recoil pattern. Assign these to the **Character Camera** component's `PlayCameraShake` call in your weapon fire logic.
  </Card>

  <Card title="Input" icon="gamepad">
    The `CAS_FPSAnimationPack` Input Actions asset, which defines the main gameplay inputs: move, look, reload, fire, ADS, and more. Wire this to a Player Input component on your character.
  </Card>

  <Card title="Prefabs" icon="cube">
    Game-ready player and individual weapon prefabs. Each weapon prefab has its CAS Settings, IK targets, and animation references pre-configured. Drop them into the character hierarchy to use immediately.
  </Card>

  <Card title="Procedural" icon="wrench">
    Procedural Animation Settings assets for features like aim-down-sights offset, weapon sway, and breathing motion. Each asset is pre-tuned to match the included weapon animations.
  </Card>

  <Card title="Scripts" icon="code">
    Custom MonoBehaviours that connect the FPS Animation Pack weapons to the CAS runtime — including item equip/unequip logic, fire event dispatching, and camera shake triggers.
  </Card>
</CardGroup>

The **Settings** subfolder contains a **Character Animation Settings** asset for each weapon, with Base Pose, Overlay Pose, Overlay Animator, and Procedural Settings already assigned. You can use these as-is or duplicate and modify them for your own weapon variants.

***

## Character Skeleton API

The **Character Skeleton** component stores the full bone hierarchy of your character and provides runtime access to individual transforms and rig elements. Custom tools, editor extensions, and integration scripts use this API to resolve bones by name or index without needing a direct Inspector reference.

`CharacterSkeleton` is added to the root bone GameObject (typically named `Root`, `Armature`, or `Skeleton`) by the CAS setup wizard.

### Updating the Skeleton

When you modify a character's bone hierarchy, click the **Update Skeleton** button on the `CharacterSkeleton` component and then apply the changes to the prefab. This rebuilds the internal bone list to reflect the new structure.

```csharp theme={null}
// Rebuilds the skeleton bone list from the current hierarchy.
skeleton.UpdateSkeleton();
```

### Key API Methods

```csharp theme={null}
// Returns all rig elements (name + index + depth) in this skeleton.
public KRigElement[] GetRigElements()

// Returns a rig element matching a specific Transform.
public KRigElement GetRigElement(Transform bone)

// Returns a rig element matching a bone name.
public KRigElement GetRigElement(string boneName)

// Returns the Transform for a bone by name.
public Transform GetBoneTransform(string boneName)

// Returns the Transform for a bone by rig element reference.
// Uses element.index first for fast lookup.
public Transform GetBoneTransform(KRigElement element)

// Returns an array of all bone Transforms in the skeleton.
public Transform[] GetTransformHierarchy()

// Returns a CharacterSkeletonBone by its index in the list.
public CharacterSkeletonBone GetSkeletonBoneByIndex(int index)
```

### KRigElement

`KRigElement` is a lightweight struct used throughout the CAS editor and runtime to refer to bones without holding a direct `Transform` reference:

| Field   | Type     | Description                                       |
| ------- | -------- | ------------------------------------------------- |
| `name`  | `string` | The bone's GameObject name.                       |
| `index` | `int`    | The bone's position in the flat skeleton list.    |
| `depth` | `int`    | The bone's depth in the transform hierarchy tree. |

### Example: Resolving a Bone at Runtime

```csharp theme={null}
private CharacterSkeleton _skeleton;

private void Start()
{
    // Find the skeleton on the root bone child.
    _skeleton = GetComponentInChildren<CharacterSkeleton>();
}

public Transform GetRightHandTransform()
{
    // Resolve the right hand bone by name.
    return _skeleton.GetBoneTransform("RightHand");
}

public void AttachPropToBone(GameObject prop, string boneName)
{
    Transform boneTransform = _skeleton.GetBoneTransform(boneName);
    if (boneTransform != null)
    {
        prop.transform.SetParent(boneTransform, worldPositionStays: false);
    }
}
```

<Note>
  `GetBoneTransform` performs a name lookup on the flat skeleton list. Cache the result if you call it every frame to avoid repeated string searches.
</Note>
