MD3 - improve animations support

If you tried, you probably would have already solved :slightly_smiling_face:

type
TMyArray = array[1…10] of byte;

var
myArray: TMyArray;

procedure myProc(TheArray: TMyArray);
begin
writeln(TheArray[1]);
end;

myProc(myArray);

To get the array passed by reference:

procedure myProc(var TheArray: TMyArray);

It should work, but check it.

Okay, I guessed that it worked that way but didn’t see it in the reference, and I always know with code it’s better to have someone else help if the manual doesn’t clarify, rather than just making a guess with no evidence/proof.

Unfortunately, no matter how much I dig, I can’t find not only the reference page in the help manuals linked above for the array in the procedure declaration you gave, but also can’t find where it tells you to declare “array [1…10]” exactly/verbatim like that.

Do you know where you got it, so I can read that reference more carefully for any questions regarding exact details like I am asking now?

Sorry, but there aren’t only the manuals you’re referring to. Internet is your friend.
The code I posted is just what I normally use.
A good online manual for beginners is DelphiBasics.
At this link you can find the definition of the arrays:
https://www.delphibasics.co.uk/RTL.php?Name=Array

Now it makes sense - you were using a reference from another source than just the manuals that came with the engine, and it’s not like I had to restrict myself to only that.

And just to check for comprehension -

The code regarding the multi-part avatar is nothing except declaring the main body as the avatar, and then using a “set animation” code for the smaller sub-sections/parts, or is there more code I have to add after that that you omitted?

I would assume however, only after I finish that code should I worry about anything else on top, so I don’t get overwhelmed with too much details at once.

Oh yeah, I know also you have to call the function to set the animation using the syntax you specified, in the appropriate places like when you wait a specific amount of seconds or press a key, but I figured that part was obvious/implied.

But is there any additional code on top of that?

Unfortunately, I learned the platformer game is in 2D and not 3D like I want (a Mario 64 style game is my objective), so I will still stick to using the third person navigation demo as my template.

Does anyone have any idea about how to configure an animation.cfg if I want the run/walk animation that is required for AutoPlay to work, to be two seperate animations rather than one big animation that affects all parts at once?

I would assume I can just use the “AutoAnimation” property of the individual scenes, and set them to the appropriate things (like legs_idle and torso_idle for idle, in this particular instance).

Does that sound like what I should do for my particular goal, or am I going about it in a wrong way that I don’t know about?

Like is it possible to use AutoPlay on the individual scenes, and not just the ThirdPersonNavigation? Not as far as I can tell reading the API, unless I am missing something.

Cause there’s the property for TCastleSceneCore, but not TCastleScene itself.

But from what I can tell in the documents, TCastleScene inherits from TCastleSceneCore, so I can use the property on that as well even though it doesn’t come up verbatim/word for word in the search?

From Pascal, you can run any animation (using PlayAnimation) or any combination of TCastleScene instances (all of them, some of them) when the SetAnimation method is called.

I get that part, I just wasn’t sure about the exact details of the syntax behind when you first set up the animation, cause it states in the manual for the AutoAnimation that it requires “idle” and “walk” animations word for word normally,

But I wasn’t sure if you can use the AutoAnimation keyword specifically on only TCastleThirdPersonNavigation as a whole, or if it’s possible to do it on TCastleSceneCore and by extension TCastleScene itself (the individual models and not the entire navigation is what I want, so that way I can have seperate automatic animations for each piece).

Does that make more sense now what I actually need help with?

I’m afraid I do not follow the question. You’re mixing a lot of things. AutoAnimation is not a keyword, it’s not on TCastleThirdPersonNavigation, it doesn’t require “idle” or “walk” word for word…

As said already in this thread, you want to call PlayAnimation to start the animations you want on any subset of TCastleScene instances you want. You can do it from the SetAnimation method override. Follow the examples and documentation from Writing code to modify scenes and transformations | Manual | Castle Game Engine on how to do this.

This is the exact quote you posted earlier about needing some details about the AutoAnimation set up for the Avatar before I can officially add it. Is that no longer true for whatever reason?

The quote (from valterb, coming also from our API docs) is still valid.

It doesn’t conflict with what I said.

Call PlayAnimation to start the animations you want on any subset of TCastleScene instances you want. You can do it from the SetAnimation method override.

In SetAnimation method, you get as input animation names (that you can set at TCastleThirdPersonNavigation properties, by default they are like “idle” or “walk”). In response, you can call PlayAnimation to start the animations you want on any subset of TCastleScene instances you want.

From this thread so far (over 200 posts), it seems this explanation may not be enough. You are confusing various terms and mix concepts in your posts. If this is not clear, please start by creating simple applications, using TCastleScene and running animations on it – as we pointed in this thread. Our docs, including ones linked above, contains simple examples.

And yes, I have been using the examples, but again things like the set animation for multi-part models weren’t covered in good detail in any of the examples during the discussion, but I think I can tell in the “md3 tags” example, it is covered now, like the robot torso has parts that are seperately animated now.

So maybe the confusion about coding isn’t necessary, because I can use the transform object as an avatar for the Third Person Navigation object now, or is that something I will still need to code (which is an awkward and tedious workaround is my point; why not simply allow it to be an avatar directly)?