Note that I told you why your code crashes. See above in this thread, 3 times now. I emphasized the critical sentence:
Initialize the field "AvatarTransform" of the instance of class "TMyMesh". It is not initialized now.It's literally a 1-line addition to your code. I'm not sure if it will solve all the problems, but I'm pretty sure it will solve the issue with your code crashing in "CreateMesh" routine, which you show on the screenshot
https://forum.lazarus.freepascal.org/index.php/topic,66238.msg507353.html#msg507353 .
Please follow on this sentence.
- If you are not sure what some words of it mean, read about it, and ask precise questions. If you don't know what the word "field" or "instance of class" means, we can point you to resources (like
https://castle-engine.io/learn_pascal ). Using classes is a big topic, there are books written on this subject, that's why we send you to read them -- it's not a topic someone will exhaustively explain in a forum post, from the ground up and completely. At least I'm not able to explain these things in a forum post, I wrote one book about it, and it's probably too short
- Follow up on the error message from the compiler. It tells you a line that crashes. See whether variables used there have reasonable values. Output these values in any way. Or use Lazarus debugger, as pointed out in this thread, to investigate these variables. See what values do they have, think whether this is the correct value, and if not -> how to change it.
- I also encourage you to create simple Pascal applications to experiment with these concepts. Simple applications independent from CGE, LCL, or really any other Pascal library. I know you've done some of it from our past threads on CGE forum -- I'm asking you to do more exercises.
- Don't try to guess this line by "trial and error", pasting various things into your code and hoping that one of them will work. E.g. in one of the later posts you added a local variable "PlayerAvatarTransform" that is just equal to "AvatarTransform" and is also unused -- these kinds of tests do not lead to solution.
Sorry for not spelling out this missing line precisely for you. But in the past, I've given you direct solutions to some questions, and the end result is not productive. You have to understand what the compiler says, how the language works, to solve simple problems (like how to initialize a field). From this, you can go and solve the big problems (like how to make a game
). The effort is really worth it, there's a lot of fun things to do, the more and more you can do