Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What''s the best approach in making a 3rd person view character climb a set of stairs to a flat surface. As an example, the player clicks on the second level of a building in an outdoor environment and the character climbs the stairs and moves to the position. Or the player clicks half-way up the stairs, and the character moves to that position. 1) What''s the best way to take stairs and levels into account when using point-click movement? 2) What''s the best way to keep the character''s feet on the stairs while it''s moving? Thanks in advance, Chris

Share this post

Link to post
Share on other sites
If you actually want to have the feet follow the stairs in a realistic fashion (unlike, say, Quake 3, where I believe the standard running animation is used), you''re tackling a pretty hard problem.

If you placed the constraint on your world that stairs were always the same height and dimension, you could approach it as an animation or forward kinematics problem. That is, you would have an animation that took your character a certain vertical and horizontal distance, with the feet positioned appropriately as to appear to follow the stairs. You would still need to find a way to position the character and initiate the animation in such as way as to follow the stairs rather than stepping over or through them.

For stairs of arbitrary size, and if your figure is articulated, it could be approached as an inverse kinematics problem. In this scenario, one foot would remain anchored while the other would follow an arc from step n-1 to step n+1. Then likewise with the other leg.

This is all just off the top of my head - I''ve certainly never implemented anything like this. Maybe someone else can offer an easier solution, but to me it seems like a pretty difficult problem.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Actually, I don''t want to get that detailed. I was just intending on having the standard run/walk animation going as you normally would. My question really is how do I know that there are stairs in front of the character when he decides to click on them? And how do I make his feet stay at the same height as the stairs go up. i.e. his foot is at y=0.0 at the bottom of staircase, 1.0 at the top of the staircase, and 0.5 in the middle of the staircase.

I guess first I have to know if the character has stepped up on the stairs...then from that point on, I check his feet against the x & z position of each step, changing his feet y position to match? That seems a bit difficult, but probably just because I''m still learning.

Or should I build my game engine such that any time the character is at a particular x & z position, his y is calculated from the object he is on (normally would be the ground, but could be each step or a small plank on the ground or anything else you could realistically step onto)? Then it is just up to me to say which objects he can or can not climb onto. i.e. I don''t want him standing on top of a wall of a building... Maybe if I just said if the object he is trying to get onto has a small delta in the y direction, let him get on that object... Tell me if I''m way off base, but this seems to make some sense to me anyway.


Share this post

Link to post
Share on other sites
If you wish your character to go up the stairs, without any more complex inverse kinematic method, then 3 animations. One for him stepping onto the first step, one for going up a second step, and one for him stepping off the top of the steps. Make sure that the first frame of the up step animation, follows from the last frame on the up first step animation... similarly make sure the end animation matches up. Each animation has the axis at a certain point relative to the step they are on/leaving... then you just play your animations in sequence, moving your character (instantaneously) to the next step. This method requires a fixed step height/depth, and cannot let the character stop on the steps really (he''ll have one leg in the air), but he can climb up as many stairs as you want... and you can get it working on sligtly curved staircases with a little effort. If you want to stick to the quake type method (which is even easier), then just move the character (at an appropriate height) along a line parallel to the stairs (ie, treat it like normal sloping ground). The ideal method, is an inverse kinematic method. The simplest way to implement this, is just to move the player by the hips, with a sort of fixed arm animation... and get the pleyers legs alternately moving in circles, but stopping at the stair surface. That way you should get a fairly natural and continuos running movement up the stairs. This method also lets you stop on the stairs if you wish, and is also handy to make walking on uneven ground more realistic. A nice inverse kinematic method, is to have all the joints "sprung" so they naturally go to a certain angle under no force. You then apply a force to the end of the limb (or at maybe heel and toe) proportional to the distance from the required location. The limb will extend to as close as it can to the required location.. and if your joint springs are well designed, it will never use an impossible position, and keep a natural "curve". ). Anyway, good luck, and I hope this all helps.

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!