Game Mechanics

Hi I hope you are having a good day.

Any ideas on how to make a character walk on stairs using code.
I want to make a single walk cycle animation and have the character lift its legs according to the height of the current terrain.

Thanks, Any Help and Solutions will be greatly appreciated.

yeah, you can parent those empties to objects, that are moved up and down via a ray, or even rotated,

this way you can change stride height, angle etc. (scaling the center object also changes the animation size)

another option, parent the raycaster to a second armature,

this armature places the feey ik at a offset to the ground

wow. that was tricky, but I think this could be very very important for games :smiley:

Thanks everyone I really appreciate the Help.
Off to do some testing.

I have done some character animation in the BGE befor ,but I have never used Inverse Kenetics. I 'm in need of a good tutorial.

Step one: have an armature rig that you want to rig.

Step 2: parent the IK node bones to specific parent bones, [ie. the torso for hands, and base for the feet.] Some assembly may be acquired.:eyebrowlift2:
The hands to the center of gravity:

and the feet to the base:

Step 3: Making the deformative bones follow the hands and the feet via Bone constraints, for easy help with this, doing one side, then duplicating and mirroring will copy the constraints but to the duplicated bones instead of the originals. Very helpful indeed.
[Notice, before any IK constraints, the hand will disconnect from the arm in pose mode.]

We want it to follow, so with the forearm selected, goto the bone constraints tab, select the constraint “Inverse Kinematics,” enter the obj name for the armature in the Target slot, then the bone you want it to follow in the bone slot. Don’t forget that the chain length needs to match the number of bones you’re trying to effect, the arms should be around 2 and so should the legs. Do so with the lower legs to the feet as well and you should be able to free move the limbs and crouch by simply lowering the center of gravity!

PS the Center of gravity should be parented with an offset to the base, and the torso and hips to the center, that way when the center drops, so do the hips and torso to simulate a crouch. also, the feet childrent should all be parented to the right bone in the foot, not the leg, not the heel, not the toes, that is important to know when you see the bone move but the foot stay.

Hi I hope you are having a good day.

Thanks a bunch I really appreciate the help.

Do you have an example blend.

honestly i dont, all of the rig above was just blender 2.72s internal meta rig, and i just rigged it to show how to us the solvers, but i can whip a quickie up for you if you want, with a nice mesh too if needed.

try this out for size


Hi I hope you are having a good day.

Thanks I really appreciate it

I was unable to imlpement the solution above, here is a blend file maybe someone ele can try.
and let me know how they did it.

Thanks, Any Help and Solutions willbe greatly appreciated.

Attachments (389 KB)

ok, here is your file back, one thing, your animation was a little off, and I removed the knee pole targets,

also you never returned to idle,

so a ray places a target, that ik tracks using a bone I added to your rig,


CharacterStart.blend (455 KB)

thought of a way to improve the system as well, i’ll add the file tonight,


now the foot ik targets move up and down in the middle of each step, as well as the stride angle changes


CharacterStartStepOffsetter.blend (484 KB)



CharacterStartStepOffsetterWorkingGreat.blend (491 KB)

Hi I Hope you are having a good day.

Thanks, I really appreciate the help.

Hi I hope you are having a good day.

I ran into a problem when the player stops while on the stairs it is unable to continue moving forward the legs stop adjusting to the terrain.

Thanks, Any Help and Solutions will be greatly appreciated.

the legs are not really moving him, (it’s not a walking ragdoll rig)

the angled surface on the bottom is what moves him up stairs,

Any idea why he gets stuck.