Cancel a Character physics Jump() before it completes

The character wrapper has evolved to pretty much exactly what i have been waiting for. I have only come across two issues and they both involve the jumping function(and possibly the wrapper’s falling physics).

The first one is the adverse effect that happens if you have any kind of collision bounds set and jump underneath anything that is too close(weird ceiling bug/glitch). It doesn’t happen if collision bounds is left unchecked but then you can’t have anything but a 1x1 cube. I’ve been working around this but would rather have a solution.

The second is the one that’s really bugging me. I’m trying to implement a ladder. It works fine as long as you don’t jump onto the ladder. If you do, the physics of the jump continues until it completes - ie, if you attach to the ladder before the jump reaches it’s apex, the object with character physics continues to slide up the ladder until it reaches the top. It then pops off the top and then slides back down the ladder. You can fight against it with the controls set up for the ladder(move up or down) but it will continue to be a fight until the jump completes. The same happens if you pass the apex and are headed in the downward arc only it just tries to slide down the ladder. It also occurs when just falling on to the ladder from above.

Movement is all done through python but it just routes the signals back to a Character Motion actuator logic brick. I was trying to recreate this with only logic bricks to attach a simple blend file but couldn’t figure out how to set the gravity to 0 for the character object(so it can go up the ladder) with just a logic brick.

So what I’m looking for is some way to cancel out of the Jump() function when it hits the ladder. Any thoughts? I originally tried using Dynamic but could never get stairs/steps worked out. I had a complicated series of sensors but it still never worked half as good as Character physics.

  1. You should check a jump may be performed using a rayCast, to ensure there is enough space above the player.
  2. With the ladder, simply check that the velocity of the player is less than or equal to 0.0 on the Z axis, (or perhaps a small positive value) which indicates that they’re either on the ground or at the top of the jump

Sorry, i should have mentioned that i have tried those solutions already.

  1. The ray cast is the work around. The problem is that the glitch still happens even if there is plenty of space to make a normal jump. So basically you have to disable jumping in areas that look like there should be no problem -> character box is 1x1x3, jump only brings character’s top Z to a little over 4, ceiling is at 6 and it still glitches. Raycast only works on a point so you would need many ray casts to search the area above the player(about 2 cubic units, that’s a lot of points to check) . Better solution is to use an object that is roughly the same shape as the character as a collision sensor.
    (edit: i just checked on the test blend and the glitch appears if the architecture above is only within the jump area or right at the apex. not as bad as i made it out to be but the workaround still cuts out the jumping ability. i wouldn’t mind if could edit the jump force but can’t access that through the api)

  2. I can’t find any reportable velocity with a Character physics jump. Neither in world nor local, linear nor angular nor inertial. Not sure if it came across but I am calling the jump function from python through the Character Movement actuator.

  1. Use a cube under the player(more smaller than the player) to detect if the player is on air.
    2)Is there some python modules for check the velocity of an object, look at object.getLinearVelocity()
  1. Character already has a function to check if on ground - character(obj).onGround. it works similar to a ground check sensor.
  2. Character physics object does not report any linear velocities

it looks like that function can only report back how far along it is in a jump,

jumpCount()

is this setable or only getable?

set it to zero?

i think jumpCount is for keeping track of how many jumps before hitting the ground(for double and triple jumping, etc.). it goes with maxJumps. jumpCount is read only and maxJumps is read/write.

(edit: actually it looks like jumpCount is consecutive jumps. if the jump key is held down(not set as TAP) the jumpCount will increase for each bounce…even beyond maxJumps. maxJumps only affects air jumps…still working on this)