# Need Help Understanding how to Assign a Transform as an Avatar of a Third Person Navigation Camera

**URL:** https://forum.castle-engine.io/t/need-help-understanding-how-to-assign-a-transform-as-an-avatar-of-a-third-person-navigation-camera/1140
**Category:** 3D
**Created:** [April 4, 2024, 10:38pm UTC](https://forum.castle-engine.io/t/need-help-understanding-how-to-assign-a-transform-as-an-avatar-of-a-third-person-navigation-camera/1140 "2024-04-04T22:38:55Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [April 5, 2024, 12:26pm UTC](https://forum.castle-engine.io/t/need-help-understanding-how-to-assign-a-transform-as-an-avatar-of-a-third-person-navigation-camera/1140/2 "2024-04-05T12:26:04Z")

</div>

Hi!

- `Avatar` ( [Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation](https://castle-engine.io/apidoc/html/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html#Avatar) ) indeed accepts only TCastleScene.

- But `AvatarHierarchy` ( [Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation](https://castle-engine.io/apidoc/html/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html#AvatarHierarchy) ) accepts any TCastleTransform.

For a model composed from multiple scenes, you most likely want to:

- leave `Avatar` unassigned (nil)
- set `AvatarHierarchy` to the “root” transformation of your avatar.

Moreover, in case you have multiple scenes and you want to control which animations on which scenes run, you will have to introduce your own class, descending from `TCastleThirdPersonNavigation`. In that class, override `SetAnimation` virtual method (  
[Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation](https://castle-engine.io/apidoc/html/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html#SetAnimation-arrayofString-) ), and run proper animations on the child scene, using any algorithm you like For example:

```auto
procedure TMyThirdPersonNavigation.SetAnimation(const AnimationNames: array of String);
begin
  // Apply desired animation in any way.
  // You are most interested in AnimationNames[0].
  // Over-simplifying, you can think that default implementation does "Avatar.AutoAnimation := AnimationNames[0]"
  if AnimationNames[0] = 'walk' then
  begin
    MyView.SceneLegs.AutoAnimation := 'legs_walk_animation';
    MyView.SceneTorso.AutoAnimation := 'torso_walk_animation';
  end else
  if AnimationNames[0] = 'idle' then
  begin
    ...
  end;
end;

```

( This is not an example ready to be copy-pasted naturally – you wil have to adjust it to your use-case. )

See the API documentation of TCastleThirdPersonNavigation – [Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation](https://castle-engine.io/apidoc/html/CastleThirdPersonNavigation.TCastleThirdPersonNavigation.html) .

See also this answer in long past thread: [MD3 - improve animations support - #71 by michalis](https://forum.castle-engine.io/t/md3-improve-animations-support/775/71)

---

_[View the full topic](https://forum.castle-engine.io/t/need-help-understanding-how-to-assign-a-transform-as-an-avatar-of-a-third-person-navigation-camera/1140)._
