would this be useful

What if it were possible to switch off character to dynamic then back again?

Could you explain why you would want to do that?

Maybe there’s a better solution to the problem you might be having :slight_smile:

KX_GameObject.suspendDynamics() and KX_GameObject.restoreDynamics() should do the trick, where “KX_GameObject” is an object in the scene, logic.getCurrentController().owner is a classic example.

Because the character physics allows for better jumping but has a impact on framerate more than dynamic physics type.

I see, so you would only enable the character physics when you jump?

Interesting, although, your best bet, if you want better performance, is to make your own jumping with a dynamic physics type.

What specifically about the character jumping do you like? Or what do you like about the character physics type in general?

jumping is not an easy thing, i have several lines of code and 2 raycasters to make mine work. i also have a custom terrain tracker to work around. double jumping is tricky and i would imagine this is the reason for character physics.

if your seeing a performance difference between character and dynamic, then we may have bigger problems.

I like how you can modify fall speed, jump force,step height and max amount of jumps before the character hits the ground.

So jumping can be done pretty easily with Python and a little bit of math.

I watched a GDC video recently on how to do jumps properly, it’s not that bad.

I implemented my jump by disabling the default gravity, and letting each dynamic object handle their own gravity force. It seems weird at first, but characters should be able to control their own jump force and fall speed.

Anyways hope that video helps, it did wonders for me haha

You should check that you don’t have crazy bounds on the character physics type, like convex hull or triangle mesh, that eats up a lot of performance. Also, it might be okay to just give up some performance for convenience, that’s up to you.

Good luck!

You cannot even configure what to jump off of.So that the npc cannot jump off of your character.That is another problem i am having.

For jumping, you should make sure your character is touching the ground. You can do this by giving all terrain and things that you can jump off a “ground” property. Then, when you press the jump button, make sure you’re touching the ground property before you apply the force.

I am using character physics type for a npc.That follows me around in cubes i dig into.She follows me around even if i dig a tunnel on another level.

Why is jumping difficult?

It is either an impulse or an initial velocity. Everything else is handled by the physics engine.

You need to think about:

  • when to allow jumping and when not
  • when to play what animation
  • what to do on landing e.g. determine the impact (=> crashing or landing)