Climbing question

Hi everyone. I try making a character climb over a cube. The main character move up with an ipo animation and the character armature which is parented with the main character do the climbing animation till it reach the main character at the top. All this happen when its collide with the box which has a property and when pressing spacebar at the same time. The problem is when it i hit space the character return at the place I do the ipo animation and not at the place the character is. Is this the good way of making character climbing without script?

Any advise

No. for walk animations and climbing animations and pretty much all animations the character should stay stationary. For example imagine a tredmill. The person walks but is not going anywere. Then the animation plays back as a loop while the character is moving forward or whatever.

I did the exact same thing. It’s difficult to make it look right with a stationary animation and trying to fine tune the motion. And yes you will need to script, but it’s not hard, python is your friend! Learn it!

So, animate your character how you want it to look. Make it so that when the conditions (a ray sensor AND some key) are right you go to the climb state (make a new state that will handle the climbing). You’ll need to disable dynamics on your collision box or whatever you have. In the climb state connect an always sensor to a python controller which will be connected to; your climbing action, a state actuator that takes you to your walking/main state, an Edit Object --> start dynamics actuator. I also added a second action which was the first frame of my idle animation which I called “after climb” to smooth it out.

Now here’s what we need the script to do!

  1. play the climbing animation
  2. Take the collision box (I assume that’s what the bones are parented to) and move it up a set distance
  3. play the after climb animation (unless your animation ends in the same spot it began)
  4. Start the dynamics and go back to the main state

Also I setup in the climb state a motion actuator connected to an always sensor to move forward (Loc, not velocity) so you end up on top of the box and don’t just fall down again.

In addition if your camera is parented to the collision box it will stay still while you move up. That may look odd so you’ll also have to add some motion to that to compensate then put it back in it’s original spot with an IPO actuator…

So… the script…
Start it the normal way. then list your sensor and actuators. Then you’ll have to tell it to get the start, end, and current frames of the climbing animation like so:

firstFrame = climb.getStart()
lastFrame = climb.getEnd()
curFrame = climb.getFrame()

next after you find out how far you need to move it define that number as Up:

Up = 9.5

then get the position your player is at (that may still be old code I’m using):

base = owner.getPosition()

Then make it add value Up to that position, “add” will be the new position:

add = base

we only want it to add “Up” to Z, so to do that we type:

add[2] = base[2] + Up

2 is the third value. so, x,y,z is 0,1,2.

Then activate the climb actuator. Once that animation is done which you find out by:

if curFrame >= lastFrame-1:

In other words one frame from the end.
Then set it to the new position:


start the “after climb animation,” start dynamics, and go to the main state.

I’ll try to post a Blend with the script so it can be better understood. I’m sure other people will want to know how to do this too.

A good idea is to make your player mesh Ghost and make the walk animation stationary. Add a Cube and scale it around your player mesh and armature so everything fits snugly inside the cube. Parent the Armature to the Cube. Make the Cube invisible. In the Armature settings add in your means of control for the sensors. Either a keyboard input or a message will suffice. For example, if a key is pressed the player will move forward along the… Y axis, which I’m supposing is in the forward direction for the player. Add these sensors to the Armature also. If the forward key (same as the one in the cube) or the same message is received, then the armature should play it’s walk animation.

So far there are 4 major objects present:
-Player Mesh
-Player Armature
-Player Cube
-Cube to climb over

I can’t go much into detail with the armature and mesh because that’s a whole different ball game. I attached a .blend file also, I hope it helps. The Touch sensor on the player cube would conflict with the player mesh used for animation though. The touch sensor is meant to drop the character back down to ground, but if it’s touching the player mesh (which I did not add in the file) then the player cube will never touch the ground unless you use a force other than Linear Velocity to propel the player cube.

PMing me is almost the only way to contact me because I most likely won’t check this thread again until Blender Artists starts sending an email each time someone replies to you or until I find said feature on Blender Artists. Until then, happy blendering!


climb ladder.blend (158 KB)

Ok here’s a blend! The code is 2.50 compliant so it may be different than the directions I posted. If this seems to complicated Riyuzakisan’s post gets the job done. However if someone cares to simplify my method I’d love to know!


climb_block_example.blend (244 KB)

Thanks. The one from Alaseridan work.

Cool, if you need help applying it to your work let me know. probably via PM.