Hi!
-
Avatar
( Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation ) indeed accepts only TCastleScene. -
But
AvatarHierarchy
( Castle Game Engine: CastleThirdPersonNavigation: Class TCastleThirdPersonNavigation ) 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 ), and run proper animations on the child scene, using any algorithm you like For example:
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 .
See also this answer in long past thread: MD3 - improve animations support - #71 by michalis