Help with Jumping Glitch

Hello all,

I’m creating my first game in Blender, nothing serious, but I have a cube here that jumps along other cubes.

And I have the jumping set up with a sensor for if the player cube is touching objects with the property “prop.floor” and a sensor for if the keyboard’s spacebar is being pressed, then those two go to an and controller, which goes to an actuator for simple motion to increase the Z force by 159.7

The problem I’m having is that when the player cube is touching two objects that have the “prop.floor” property, the player cube shoots into the air. It happens particularly when it’s touching the side of a cube and a cube below it.

Is there a way I can make the prop.floor property only work on one face of the cube? Or is there any other workarounds?

Thanks

If jump=0----------and------------applyForce
If keyboard(jump)–/__--------property jump=30
Ray(-z) 1.05(map)/

Property jump min:2 max:30-----and--------add add -1 to jump

If jump=1 -------------and---------jump=0
Ray(-z)1.05(map)-----/

You can use collide instead of ray if you wish.

Attachments

JumpLogicTimer.blend (439 KB)

Hi,
You can use a Ray Sensor pointing down, like in the example above, but you can also use a simple designated “Sensor” object parented below your player to detect the ground.

I would also recommend enabling the “Tap” mode on the keyboard sensor to avoid continuous jumping.
This will send only one pulse to the controller, instead of multiple pulses until you release the key. That was one of the reasons why your cube was flying away.

Hope that helps,
Made a little example using a ground sensor object

Attachments

jumpTest2.70.blend (495 KB)

That is why I use a timer, and don’t allow the timer to go from 1->0 without the ray(ground)

also this state can play->Jump 30-1 (jump up animation)

1- Fall animation until touching ground