Help with jumping characters

hey i really wanna thank Grimreaper for helping me out with my walking problem. I got it and now im doin all kinds a stuff.

         But i've been tryin ta get  my character to jump.
    His animation is great and u can trigger it by hitting space but, im really not sure what to do with the motions to make him descend after rising. He just jumps and stays on that level. Any ideas? 
Please help me, i really wanna finish my first project so i can further my skills in blender and game design.    When i finish it i'll post the first level !  

HAha its gonna b so sweet...

Not sure what you’re getting at though. Are you talking about the descending action of your character. Say a person jumps there’s a jumping action, and when he starts to come down, the knees bend to brace for impact to the ground.

If that’s what you mean. Make the animation for coming down, and with logic bricks, use a ray sensor to detect some distance when you’re off the ground. Hmm, thinking more, the ray should only activate when there’s a negative velocity down (might need python to getVelocity). When the ray detects ground start the coming down action and when the character touches the ground, have him stand upright again. There’s also some tweaking involved to get it just right.

Jason Lin

no golden i think what he needs is just gravity

He just jumps and stays on that level

Hehe, my mistake. Hmm, should have been rephrased he just stays in the air. Then it must be high damping. Just have a huge force pushing the character downwards, then he won’t stay in the air. This also means you need a higer force for jumping also.

Jason Lin

glad to help ;).
hhhmm, i dont have time too read what you said goldentaiji sorry ill say what i think it is,

  1. you have animated your character jumping and actually taken him up with armatures thats a no no, you should animate him coming up but not leaving the ground. then add the action in the buttons.
  2. you need gravity.

okay here goes

for a game character’s dynamics:

make damp 0

make gravity a reasonable value (9.8 if you are to scale, 1m = 1 blender unit)

use linv for all motion
[you probably want to use python for this]
use linv for jumping
do not apply motion when not on ground [you can’t move left or right real well in the air can you? many platformers simply apply limited motion [but force instead of linv] when in the air]
give ground material a friction of 1.0 [so when you stop pressing a key, or hit the ground moving not pressing a key [assuming proper motion script] you stop moving…]

so, to move:
find direction and amount of motion [so, probably local or global xy axis motion]
set the linear velocity part of the motion actuator to that stuff
if the motion you just set to is zero, send a false pulse
otherwise send a true pulse
[if you send a true pulse when the motion is zero you will continue moving, when you want to come to a stop]

now then, for jumping you simply add an upwards linear velocity, and gravity should take care of the rest

this applies to both first and third person controls

so, you can look at how I setup the controls in for the python script

… or I can paste it here

# this script simply sums up the motions
# I want to go on this frame
# I do this because multiple motion actuators
# on one object at a time don't work perfect

# also to make combined strafe and walk no 
# faster than one or the other

speed = 5.0
jspeed = 5.0
sqrt2over2 = 0.70710678

cont = GameLogic.getCurrentController()
obj = cont.getOwner()
act = cont.getActuator("move")

onGround = cont.getSensor("onGround")

if onGround.isPositive():
	jump = cont.getSensor("jump")
	fwd = cont.getSensor("fwd")
	back = cont.getSensor("back")
	slft = cont.getSensor("slft")
	srght = cont.getSensor("srght")
	fspeed = speed * (fwd.isPositive() - back.isPositive())
	sspeed = speed * (srght.isPositive() - slft.isPositive())
	if fspeed and sspeed:
		fspeed *= sqrt2over2
		sspeed *= sqrt2over2
	jump = jspeed * (jump.isPositive())
	act.setLinearVelocity(sspeed, fspeed, jump, 1)
	if [sspeed,fspeed, jump] == [0.0, 0.0, 0.0]:
		GameLogic.addActiveActuator(act, 1)

now that I play with it, it looks like the last 2 lines have no effect
[I forget now why I put them there…]

alright bfore i can do this, and i really appreciate all ur help guys, im not seeing any of the global settings buttons i see in the online game engine referance.
I mean the dampening and Dynamics everyone’s been tellling me about arent on when i go to the Logic button.
Is it because version 2.34 is different from past ones?

go into the world buttons and u see in the middel section and there are physic settings that should work.

all right thnks a bunch, im gonna try this out til i get it right…

okdude, pm me if you need some .blends ;).