STORY: Hello to the Panda3d Community, I,m new here, and this is my first post, you see i,m a beginner at python and panda3d, but I really wanted to make a 3d game that would not be hard on my laptop, so I looked up a couple of python tutorials to get a bit of what is going on.
So I just went with it on panda3d following the tutorial given in the manual on this website, I managed to get a test plane as well a test model that I created both in blender to run in panda3d, so I started work on creating a sample game, I was going to create a sample based on the popular nintendo 64 game “Super Mario 64” since it was such a simple 3d game.
Thanks to the sample “Roaming Ralph” I was able to look at the code and understand what was happening (mostly), so I copied (typed myself) some code from it into my own script to get things going, everything was fine until it came to the movement, I tired some mathematical concepts to emulate Mario’s movement, but panda didn’t want to play ball for some reason.
Now, I do not know if it had anything to my inexperience with python, but I wonder if functions have a limitation with dealing with variable changes or something, I later discovered that global variables work to a certain extent, so I eventually settled with changing the character rotation being a increment of rotational positions leading to one final position.
Which looked ugly, but if it worked, it worked, so I moved onto the camera, roaming ralph’s camera is great but needed a bit of tweaking, like for example if you rotated the camera and tried to move in a direction, the character would move in the direction based on the character’s point of view, not the camera’s point of view, which is not the case in Mario 64.
PROBLEM: so my problem is, I set up 2 global variables, and created a question where it asks if the camera controls are pressed, then it asks which of them are pressed, if one of the keys were pressed it moves the camera and copies that movement as a calculation to variable 1.
Then when you let go of the keys, the “if not” statement of that question was to kick in and record the variable 1 result into variable 2, the variable 2 is then transferred to the movement code, the idea was to track camera movement but not alter the directional perspective until the camera stopped, then reshape player movement based on where the camera is facing just like in Mario 64
By calculating based on the last recorded movement of the camera, that is where I would have went, if I did not run into this problem, you see I tested this theory on panda3d, and it hanged not even giving a error, it was not python because the python IDLE went off without a hitch, it seemed to stem from panda itself and what is worse, is, I did not get a error message to tell what I did wrong.
So I tweaked the code just to use simple numbers as I thought “self.camera.gettX()” which was my original attempt, was outputting a vary large number that was causing panda3d to freak out, but no, even a simple number still made panda3d hang without a error message, so I ask what do you think went wrong, was it me and my inexperience with python?
Or is there a quirk in panda that I do not know about, that causes panda not to work with variables inside functions? sadly I would have provided my complete project but the forum would not let me upload due to me being a new user, I could upload it on my website if requested, and to anyone who listens (and helps) thanks vary much, and have a nice day.