Jump problem

I have this simple jump set up

space bar to jump with touch sensor and actuator’s force of 300

works well but when I come close to any kind of obstacle it jumps way too high

What is the problem? what do I do to fix it? Maybe there is a better way to do the jump altogether?

The first thing I suggest is to turn on the “Tap” option in the keyboard sensor.
In fact, for now, that’s all I suggest; that should fix it.

Good luck,
-Chaser

if for some reason you cant use tap. You can have a state for being airbourne and a state for being on the ground.
Then when you press jump it can push you up and switch the state.

Or you can take down the ‘300’ to something like 75.

I better start learning the states system because the tap option didn’t work (it just didn’t jump at all) and turning down the force does not allow to jump on the spot high enough.

I just wish there was a more thorough book on BGE. GameKit 2 just describes things but does not explain them.

Hi,

you don’t “need” states to jump now that we have the tap option.
It works, it’s just that you don’t know how to use it yet.
See attached file “basic_jumping.blend”

States are very useful for a more complex setup (special actions when jumping, fall state, etc).
See attached file “basic_state_jumping.blend”

So, here are the two functional .blend.
I think you will have a better understanding by studying this.

Attachments

basic_jumping.blend (128 KB)basic_state_jumping.blend (128 KB)

Another thing to try would be to add a property called “ground” (it can be any type of property) to all your ground bits. Then set the touch sensor to only return true if it’s touching something that has the property ground. This will ensure that your jump function doesn’t climb up walls and other objects.

Actually, this now seems obsolete, thanks to the “tap” option. I assume that was a 2.49 addition?

Thanks all, I think I have a better understanding of it now.

use a ray -z, distance :1.0, leave the property blank so it can collide with anything. Turn the tap option on. Code should be something simple like:

jump = 0
if ray.positive
jump = jumpV velocity
//do the motion etc etc