AvatarHierarchy is a property of type TCastleTransform (see API docs Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation ) . So you just set it like
MyNavigation.AvatarHierarchy := MyTransform; // MyTransform here is just an example
To call PlayAnimation, you need an instance (some TCastleScene) on which you call it. Like
MyScene.PlayAnimation('...', true);
See Writing code to modify scenes and transformations | Manual | Castle Game Engine for docs. It links to examples (that are tested and compile), try them first ![]()
The calls to the MyScene.PlayAnimation('...', true) should be done from SetAnimation method implementation. The “method implementation” term in Pascal means the piece of code between begin...end in the implementation section of the unit. It could be like this:
procedure TMyThirdPersonNavigation.SetAnimation(const AnimationNames: array of String);
begin
if AnimationNames[0] = 'idle' then
begin
ExampleLegsScene.PlayAnimation('idle', true);
ExampleTorsoScene.PlayAnimation('idle', true);
end else
if AnimationNames[0] = 'walk' then
begin
ExampleLegsScene.PlayAnimation('walk', true);
ExampleTorsoScene.PlayAnimation('walk', true);
end;
end;
As warned before, this is just an example, not something that will compile – for starters, I count you can yourself figure out how to pass the ExampleLegsScene and ExampleTorsoScene to have them available for that piece of code. If unsure, consult Pascal resources pointed in earlier post – one way to achieve it is to define and initialize additional fields in TMyThirdPersonNavigation, like ExampleLegsScene, ExampleTorsoScene: TCastleScene.