# BoneTransform

<Badge tone="type">C++ class</Badge> <Badge>C++ only</Badge>

```cpp
class AR51SDK_API BoneTransform;
```

A handle to a single bone of a [`UPoseableMeshComponent`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Components/UPoseableMeshComponent), carrying a cached **bind-pose** (init) transform. The IK solver and the character's finger-joint accessors (`UAR51Character::GetLeftHandJoints()` / `GetRightHandJoints()`) hand these out so you can read or override a bone's pose, then push the result back onto the mesh with [`Apply()`](#apply).

:::note[C++ only]
`BoneTransform` is **not** Blueprint-exposed (no `UFUNCTION`/`UPROPERTY` reflection). It is callable from C++ only.
:::

:::caution[Units & space]
All positions are in **centimetres**, all rotations in **degrees**, and world reads/writes are in **UE world space** (per `EBoneSpaces::WorldSpace`). AR 51 mocap data is metres — convert at the boundary if you mix the two.
:::

## Identity

<div className="apiPropTable">

| Member | Type | Description |
|---|---|---|
| `BoneIndex` | `int` | the bone's index within the [`UPoseableMeshComponent`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Components/UPoseableMeshComponent) |
| `BoneName` | [`FName`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FName) | the bone's skeleton name |

</div>

## Method summary

**Bind-pose reads** (the cached init transform)

| Method | Returns | |
|---|---|---|
| [`initLocalPosition` / `initLocalRotation` / `initLocalScale`](#bind-pose-reads) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) / [`FQuat`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FQuat) | <Badge>C++ only</Badge> |
| [`initPosition` / `initRotation` / `initScale`](#bind-pose-reads) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) / [`FQuat`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FQuat) | <Badge>C++ only</Badge> |

**World read/write**

| Method | Returns | |
|---|---|---|
| [`position` / `rotation` / `lossyScale`](#world-readwrite) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) / [`FQuat`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FQuat) | <Badge>C++ only</Badge> |
| [`localToWorldMatrix` / `worldToLocalMatrix`](#world-readwrite) | [`FMatrix`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FMatrix) | <Badge>C++ only</Badge> |
| [`SetPosition` / `SetRotation` / `SetLossyScale`](#world-readwrite) | `void` | <Badge>C++ only</Badge> |

**Local read/write**

| Method | Returns | |
|---|---|---|
| [`localPosition` / `localRotation` / `localScale`](#local-readwrite) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) / [`FQuat`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FQuat) | <Badge>C++ only</Badge> |
| [`SetLocalPosition` / `SetLocalRotation` / `SetLocalScale`](#local-readwrite) | `void` | <Badge>C++ only</Badge> |

**Hierarchy & commit**

| Method | Returns | |
|---|---|---|
| [`Apply`](#apply) | `void` | <Badge>C++ only</Badge> |
| [`GetParnet`](#hierarchy) *(sic)* | `BoneTransform` | <Badge>C++ only</Badge> |
| [`SetParent`](#hierarchy) | `void` | <Badge>static · C++ only</Badge> |
| [`GetChildren` / `GetChild` / `GetChildOrNull`](#hierarchy) | `…` | <Badge>C++ only</Badge> |

→ Full descriptions in [Method details](#method-details) below.

## Method details

### Bind-pose reads

<ApiBody kind="method" tags="C++ only">

```cpp
FVector initLocalPosition() const;
FQuat   initLocalRotation() const;
FVector initLocalScale()    const;

FVector initPosition() const;   // world
FQuat   initRotation() const;   // world
FVector initScale()    const;   // world
```

The bone's **bind-pose** (rest) transform, captured when the handle was created — both in the bone's local space (`initLocal…`) and in UE world space (`init…`). Use these as the reference pose to compute offsets against the live pose.

<Returns type="FVector / FQuat">the cached init position (cm), rotation (degrees, as a quaternion), or scale</Returns>

</ApiBody>

### World read/write

<ApiBody kind="method" tags="C++ only">

```cpp
FVector position()   const;   // UE world space, cm
FQuat   rotation()   const;   // UE world space
FVector lossyScale() const;   // accumulated world scale

FMatrix localToWorldMatrix() const;
FMatrix worldToLocalMatrix() const;

void SetPosition(const FVector& WorldPosition);
void SetRotation(const FQuat&   WorldRotation);
void SetLossyScale(const FVector& WorldScale);
```

Read or override the bone's current pose in **UE world space** (centimetres / degrees). `lossyScale()` is the non-recoverable accumulated world scale (matching Unity's `Transform.lossyScale`). The two matrix getters give the bone's full world transform and its inverse.

Setters stage the new value; nothing reaches the mesh until you call [`Apply()`](#apply).

<Params>
<Param name="WorldPosition" type="FVector">target world position, **cm**</Param>
<Param name="WorldRotation" type="FQuat">target world rotation</Param>
<Param name="WorldScale" type="FVector">target world scale</Param>
</Params>

<Example inferred>

```cpp
// Nudge a finger joint 1 cm along world +Z, then commit
for (const TSharedPtr<BoneTransform>& Joint : Character->GetRightHandJoints())
{
    Joint->SetPosition(Joint->position() + FVector(0, 0, 1.f));   // UE cm
    Joint->Apply();
}
```

</Example>

</ApiBody>

### Local read/write

<ApiBody kind="method" tags="C++ only">

```cpp
FVector localPosition() const;
FQuat   localRotation() const;
FVector localScale()    const;

void SetLocalPosition(const FVector& LocalPosition);
void SetLocalRotation(const FQuat&   LocalRotation);
void SetLocalScale(const FVector&    LocalScale);
```

Same as the world accessors but relative to the bone's parent. Local rotation is the value you usually animate per-joint (e.g. finger curl). Setters stage the value; call [`Apply()`](#apply) to push it to the mesh.

<Params>
<Param name="LocalPosition" type="FVector">parent-relative position, **cm**</Param>
<Param name="LocalRotation" type="FQuat">parent-relative rotation</Param>
<Param name="LocalScale" type="FVector">parent-relative scale</Param>
</Params>

</ApiBody>

### Apply

<ApiBody kind="method" tags="C++ only">

```cpp
void Apply();
```

Finalizes the staged transform onto the underlying [`UPoseableMeshComponent`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Components/UPoseableMeshComponent). The `Set…` calls only update this handle's working state — `Apply()` is what makes the change visible on the mesh. Call it once per bone after staging all the position/rotation/scale you want.

</ApiBody>

### Hierarchy

<ApiBody kind="method" tags="C++ only">

```cpp
BoneTransform GetParnet() const;   // (sic) — spelled "GetParnet" in the SDK
static void   SetParent(BoneTransform& parent, BoneTransform& child);

TArray<BoneTransform> GetChildren() const;
BoneTransform         GetChild(int i) const;
BoneTransform         GetChildOrNull(int i) const;
```

Walk or rewire the bone hierarchy. `GetParnet()` returns the parent bone handle (note the SDK's misspelling). `SetParent` is **static** — it reparents `child` under `parent`. `GetChild(i)` indexes a child directly; `GetChildOrNull(i)` is the bounds-safe variant that returns an invalid/empty handle instead of asserting when `i` is out of range.

<Params>
<Param name="i" type="int">child index</Param>
</Params>

<Returns type="BoneTransform">the requested parent or child bone handle</Returns>

</ApiBody>

---

## TTransform

<Badge tone="type">C++ class</Badge> <Badge>C++ only</Badge>

```cpp
class AR51SDK_API TTransform;
```

A Unity-[`Transform`](https://docs.unity3d.com/ScriptReference/Transform.html)-style wrapper over an [`AActor`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/AActor) / [`USceneComponent`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/USceneComponent). It exists to make **porting Unity code** to Unreal easier: it exposes the same `position` / `localPosition` / `eulerAngles` / `parent` / `GetChild` surface a Unity developer expects, mapped onto UE actors and scene components. It is a convenience utility — **not** part of the mocap data path.

:::note[C++ only]
`TTransform` is **not** Blueprint-exposed. It is callable from C++ only.
:::

:::caution[Units]
UE units throughout — positions in **centimetres**, rotations in **degrees**. (Unity code being ported uses metres/degrees; convert positions when bridging.)
:::

## Method summary

**Transform read/write**

| Method | Returns | |
|---|---|---|
| [`position` / `localPosition`](#transform-readwrite) (+ setters) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) | <Badge>C++ only</Badge> |
| [`rotation` / `localRotation`](#transform-readwrite) (+ setters) | [`FQuat`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FQuat) | <Badge>C++ only</Badge> |
| [`eulerAngles` / `localEulerAngles`](#transform-readwrite) (+ setters) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) | <Badge>C++ only</Badge> |
| [`localScale` / `lossyScale`](#transform-readwrite) (+ setter) | [`FVector`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FVector) | <Badge>C++ only</Badge> |
| [`localToWorldMatrix` / `worldToLocalMatrix`](#transform-readwrite) | [`FMatrix`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Core/FMatrix) | <Badge>C++ only</Badge> |

**Hierarchy**

| Method | Returns | |
|---|---|---|
| [`GetParent` / `SetParent`](#hierarchy-1) | `TTransform` / `void` | <Badge>C++ only</Badge> |
| [`GetRoot`](#hierarchy-1) | `TTransform` | <Badge>C++ only</Badge> |
| [`GetChildren` / `GetChild`](#hierarchy-1) | `…` | <Badge>C++ only</Badge> |
| [`DFS`](#hierarchy-1) | `…` | <Badge>C++ only</Badge> |

**Utility**

| Method | Returns | |
|---|---|---|
| [`IsValid`](#utility) | `bool` | <Badge>C++ only</Badge> |
| [`GetName` / `SetName`](#utility) | `FString` / `void` | <Badge>C++ only</Badge> |

→ Full descriptions in [Method details](#method-details-1) below.

## Method details

### Transform read/write

<ApiBody kind="method" tags="C++ only">

```cpp
// World
FVector position()      const;   void SetPosition(const FVector&);     // cm
FQuat   rotation()      const;   void SetRotation(const FQuat&);
FVector eulerAngles()   const;   void SetEulerAngles(const FVector&);  // degrees
FVector lossyScale()    const;

// Local
FVector localPosition()   const; void SetLocalPosition(const FVector&);
FQuat   localRotation()   const; void SetLocalRotation(const FQuat&);
FVector localEulerAngles()const; void SetLocalEulerAngles(const FVector&);
FVector localScale()      const; void SetLocalScale(const FVector&);

// Matrices
FMatrix localToWorldMatrix() const;
FMatrix worldToLocalMatrix() const;
```

The full Unity-style transform surface, in both world and local space, mapped onto the wrapped actor/scene component. Euler getters/setters mirror Unity's `eulerAngles` / `localEulerAngles` (degrees); `lossyScale()` is the accumulated world scale. Unlike `BoneTransform` there is no `Apply()` — writes go straight to the underlying [`USceneComponent`](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/USceneComponent).

<Example inferred>

```cpp
// Port of a Unity snippet: face the world origin
TTransform T(MyActor);
const FVector Dir = (FVector::ZeroVector - T.position()).GetSafeNormal();
T.SetRotation(FRotationMatrix::MakeFromX(Dir).ToQuat());
```

</Example>

</ApiBody>

### Hierarchy

<ApiBody kind="method" tags="C++ only">

```cpp
TTransform            GetParent() const;
void                  SetParent(const TTransform& parent);
TTransform            GetRoot() const;
TArray<TTransform>    GetChildren() const;
TTransform            GetChild(int i) const;
TArray<TTransform>    DFS() const;
```

Navigate or rewire the scene-graph the way Unity's `Transform` does. `GetRoot()` returns the topmost ancestor; `DFS()` returns the subtree flattened in depth-first order (root first), handy when porting Unity hierarchy traversals.

<Params>
<Param name="i" type="int">child index</Param>
<Param name="parent" type="TTransform">the new parent to attach under</Param>
</Params>

<Returns type="TTransform">the requested parent, root, or child wrapper</Returns>

</ApiBody>

### Utility

<ApiBody kind="method" tags="C++ only">

```cpp
bool    IsValid() const;
FString GetName() const;
void    SetName(const FString& name);
```

`IsValid()` reports whether the wrapper still points at a live actor/component — check it before dereferencing a handle you have held across frames. `GetName` / `SetName` read and set the wrapped object's name.

<Returns type="bool">`true` while the wrapped actor/component is valid</Returns>

</ApiBody>

## See also

- [`UAR51Character`](/docs/sdk-api/unreal-api/classes/uar51character) — hands out `BoneTransform` finger-joint handles via `GetLeftHandJoints()` / `GetRightHandJoints()`
- [`USkeletonConsumer`](/docs/sdk-api/unreal-api/classes/skeletonconsumer) — the consumer that drives the characters whose bones these handles wrap
- [Utilities & platform](/docs/sdk-api/unreal-api/utilities-platform) — other C++ helper/adapter types
- [Class index](/docs/sdk-api/unreal-api/classes) — all Unreal SDK types
