Hello Panda3D forum. I am stuck at a point where I need to add character collision in a way where the character can jump and have a jet pack etc, etc. Should I use the built in collision, or ODE physics? If someone could please point me somewhere that would be great.
Depends. For simple gravity simulations like gravity, jetpack you really don’t need a physics engine. If you’re looking into advanced stuff like Ragdolls or so you’d need a real physics engine like ODE.
Thanks for the quick response. So, I would just need to use collisions. But where would I start? Would I use a ray or a tube or a sphere for the characters collision? I could probably figure out gravity and jumping on my own.
I see no code that attempts to do jump at all there?
If you want to jump, then first detect the jump key, and add some velocity to the Y direction the first frame it’s pressed after not being pressed. The trick is to remember whether the last frame had the key down or not. Also, because it’s an impulse over a single frame, the delta velocity needs to be pretty big (like, velocity.y += 5 or so, assuming feet for measurement).
Then you may want to improve it such that you can only jump when you have a ground collision – that means you have to detect the ground collision, and set a flag appropriately.