Jump to content
  • Advertisement
Sign in to follow this  
Jiia

Skeletal Tilting on Sloped Terrain

This topic is 5470 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

Yeah [disturbed] I have no idea where to post this. Mods, feel free to move it wherever you like. I was thinking game-programming, but there is a decent amount of math streaming through it. Anyways, I'm sure the subject pretty much spells it out. I want to animate skeletal characters standing, walking, and running, on slopes. Not just rotate body 45 degrees type animation. I mean like left leg shifted up, body tilted, left arm sticking out a bit type animation. My first idea was as cheap as it gets. I planned to create a single keyframe animation stance of how the bones should be modified to orientate to a slope left, right, forward, and back. Then blend those together with anything the character is doing while on a slope. To test this out, I made a quick left-tilt pose and blended it with walk. Unfortunately, I have no idea how to blend the keyframes the way they really need blended. My animation keys and character bone states are all quaternions. I can't seem to find a method to do a quat_res = (quat_walk * 1.0) + (quat_tilt * fac); where fac can be 0.0 to 1.0 for the slope, and the 1.0 is always 1.0 regardless of fac. When doing this, the value of fac seems to have very little to no effect, and 100% of quat_walk is never used. Time for the math guys to laugh at me. I tried (for testing purposes only) to convert keys to matrices, blend them, then convert the result back to quaternion, and it works, some-what. The result still looks like crap, and I can't seem to adjust fac to have the correct gradual removal of the sloped posture. Is there any way that I can use a single keyframe animation posture to offset rotations in other animations for something like this? If not, how is something such as sloped postures coded for games? How can I make my character stand sideways on a 45 degree slope?
    O  /
   -|-/
   /\/
    /
   /
Thanks for any help [lol] EDIT: I forgot to mention that my bone animation transforms are local-space. They do not include orientation of the bone in the hierarchy and such. In other words, it's okay to use 100% of two animations. It won't lock the character into some kind of knot.

Share this post


Link to post
Share on other sites
Advertisement
Hmmm. The way you walk up a hill (or down, for that matter) is significantly different to walking on the flat. So, you may want three sets of walking animation: flat, up and down; and then blend between flat/up or flat/down:
anim = flat * frac + up * (1 - frac)
where frac is proportional to the gradient.
The next problem then becomes making sure the feet don't go through the ground, although this is aleviated with the above blend (if the up animation was for a 45o slope frac = 0, and a 30o slope, frac = 0.5).

Skizz

Share this post


Link to post
Share on other sites
Yes, but what about walking along the side of a hill? So you're heavy on one leg and light on the other?

Then you need 5 anims, and interpolate between them all. Maybe 9 just to make sure the diagonals look good. Fun, yes?

Share this post


Link to post
Share on other sites
Yes Pxtl, that is my problem. Not only 9 for every angle, but 9 for standing, walking, running, turning-to-walk, jumping, landing from jumps.. You can see why I tried the cheap way. If I could find a way to "add" tilt to animations, I would have an extra 3 years to do other things. [smile]

Is there any other way I can do it?

Anyone feel free to think out loud. I'm open to even the dumbest ideas.

Share this post


Link to post
Share on other sites
Quake3 style - just tilt the whole lower body. Wouldn't be perfect - you'd probably lave a limit of like 20 degrees. No anim blending needed.

Share this post


Link to post
Share on other sites
In the latest game developer magazine there was a system that adjusted the skelton to follow the terrain. Check the article out if you can have access to the magazine. Can't remember the title, but it was mostly about feedback loops, and used the terrain following as an example.

Share this post


Link to post
Share on other sites
Well, not to sound greedy, but I need some support for pretty steep hills. This is a medieval fighting + RPG, so hills and valleys are a biggie.

I did try just rotating the hip, abdomen, chest, and adding some raise to the arm that is on the high end, and it still looks quite hilarious [lol]

I appreciate the idea though, very much.

Share this post


Link to post
Share on other sites
maybe come up with walking animation system that depends on delta X and delta Y to calculate foot placement and tilt of the legs. what i mean is the points in which the feet should be placed on the hill form a secant line in the curve of the hill (think 2 dimensions). depending on the slope of this secant line, determine at what angle to tilt the legs toward the hill(maybe whatever looks the most natural come up with some relationship). The upper body then can simply be animated to look like it is in a sense going up stairs. i.e. shoulders piviting back and forth in alternating steps, arms slightly suspended out from the body. basicly try to come up with a way to multiply transformations into the joints of the lower body depending on delta X and delta Y of the secant line. the length of the secent line between its to points is the stride of the step. i wish i could come up with a more mathmatical representation. hope this made sense.

[edit: also, as the hill gets too steap this will look un-natural because at some point a incline must be climbed and not "stepped up", which isnt a problem because you may have wanted to limit the steapness in which you could keep going anyway.]

sky

Share this post


Link to post
Share on other sites
I think maybe you shot above my math level, blu. I can rotate limbs to make one foot higher than the other. I can even rotate the legs forward OR backward, depending on where it was before modification. But I can't seem to get it to look good while walk-type animating.

If the leg is bent forward, then rotate the thigh forward and the shin back by the same amount. If the leg is bent back, rotate the shin back and the foot forward by the same amount. The amount I am guessing at. I have no idea how to determine the rotation arc depending on how far the foot needs lifted. Also, this all looks great, but what about where it's animating and swinging from back to forward? I can't just jump between different foot-lifting algorithms. I would have to make a smooth transition. So ..what? I factor between bending forward or back?

Hehe, sorry. I just woke up [oh]
Thanks for help. Ratings++.

Share this post


Link to post
Share on other sites
you can use a stair-walking animation if the hill is that steep. Something you should have in a mediaval games (no lifts then). Steeper even, he'll just crawl up the hill.

Else, it's inverse kinematics, mech-warrior style. (it's on Gamasutra somewhere). Could be too mechanical too.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!