• Advertisement

Animating characters on sloping ground

Recommended Posts

Anyone have any suggestions for ways of animating characters on varying slopes on landscapes? I've no idea what are standard ways of dealing with this, and have been putting this off to some extent. The issues are mainly with larger animals cutting through the terrain on slopes.

elephants2.jpg.bde85e4247bea9227a7540faf5bda775.jpg

I've tried raising animals up higher above the land, but they look obviously 'in the air' in certain positions. I've also tried putting 2 land height probes at the front and rear, so that they change height according to their orientation, but that looks silly with strange changes in elevation as they move. I've also tried changing the pitch angle when rendered, this looks a bit silly (but not out of question lol).

Another possibility is to turn off depth testing against the landscape, but I would have to figure a way of still having it working when they are behind mountains. Perhaps if I push back the depth value of the land this will work.

I have read this article on mechwarrior 4:
https://www.gamasutra.com/view/feature/131863/animation_blending_achieving_.php

and I see they deal with it by having a flat animation, left and right and up and down slope animations, and blending between them. I can do this, but it sounds like a lot of extra animations for a one man team, and it also means I'd probably have to use a lower / upper body split for all animations, rather than be able to use full body. Plus use some performance for the blending (this is on mobiles).

I've not really used IK before in game, is this a realistic / practical solution? Or can I use a simpler system, make some standard poses on flat, and slopes, then measure knee etc angle offset, then blend in these offsets with some scaling at runtime to make the legs more bent or extended?

croc.jpg.f1afe806dc88ab22ec152e3b806d9603.jpg

Another solution is to just design around the problem and make the large animals only able to move over flat ground. I guess this is more what happens in real life, I haven't seen many crocodiles climbing up slopes on nature progs lol.

Any thoughts, experiences on this would be welcome. :)

 

Edited by lawnjelly

Share this post


Link to post
Share on other sites
Advertisement

Maybe having an up-vector for the models that points in the same direction of the face normal of the underlying polygon? And Orientate your model to coincide with that?

Share this post


Link to post
Share on other sites
10 hours ago, markypooch said:

Maybe having an up-vector for the models that points in the same direction of the face normal of the underlying polygon? And Orientate your model to coincide with that?

I did try this (just with pitch rather than taking into account roll, but the effect was similar). It 'kinda' works but it looks a bit wierd (as gravity no longer seems to be pointing downward). I guess I may end up partly using a milder version of this as part of a solution.

Share this post


Link to post
Share on other sites

I don't think there is any "standard" way and as far as I know stuff can get very fancy there. Take for example HumanIK which dynamically adjust the model and has been used in many AAA games : 

 

Edited by ChuckNovice

Share this post


Link to post
Share on other sites
On 1/28/2018 at 2:05 PM, lawnjelly said:

Any thoughts, experiences on this would be welcome.

There is a old trick for this.

You attach a sphere collider at the bottom of the rig. The sphere tilts the model and the back legs blocks the fall.

You can then use ray cast to move the legs to the surface and all kinds of fancy tricks. Here is a ugly example I made in Blender just to show the concept:

Sphere.thumb.jpg.6acc99f26deb7aec1589559fb4b61a66.jpg

Search for : Sphere collider align to terrain

Or something like that, this is a very old and well used trick.

 

Share this post


Link to post
Share on other sites

Thanks guys! I've found some IK example source code and it doesn't look as frightening as I feared. So I'll try and have a go when I get some spare time! :)

Share this post


Link to post
Share on other sites
5 hours ago, lawnjelly said:

Thanks guys! I've found some IK example source code and it doesn't look as frightening as I feared. So I'll try and have a go when I get some spare time! :)

Post the link(s) if they're available for others in the future that use this thread :)

Share this post


Link to post
Share on other sites

https://www.youtube.com/watch?v=2772HKIsf1M

http://www.darwin3d.com/gdm1998.htm

It turns out I'd actually done stuff similar to the CCD algorithm in the past.. although the constraints will be fun, one suggestion was to convert to euler angles, do the constraints, than back to quaternions. First I'll try the 2 bone analytical solution though, as it might work for leg heights and I would guess is the most efficient.

It has inspired me I might use a similar technique to animate the snake in game! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By spacerat
      we are looking for someone who can develop a fully automatic [recruiting information removed by moderator - please use jobs section]
       
       
    • By DeadPixelDeviants
      DeadPixel Deviants is a tiny (3 official members, 1 honorary member) team searching for one or more artist(s) and animator(s). The game currently being worked on is a 3D, single player RPG, however 2D artists may still message us to assist with future games.
       
      "Project Zodiac" current progress as of roughly one week: 
       
    • By INTwindwolf
      COMPANY AND THE PROJECT
      We are an indie game studio consisted of professional and skilled artists who are dedicated indie enthusiasts. Our current project is INT, developed on Unity Engine 5 for platforms Windows, Linux, and Mac. We are recruiting a few more members on the team to finalize our playable demo.

      INT is a 3D Sci-fi RPG with a strong emphasis on story, role playing, and innovative RPG features such as randomized companions. The focus is on the journey through a war-torn world with fast-paced combat against hordes of enemies. The player must accomplish quests like a traditional RPG, complete objectives, and meet lively crew members who will aid in the player's survival. Throughout the game you can side and complete missions through criminal cartels, and the two major combatants, the UCE and ACP, of the Interstellar Civil War.
      Please note that all of our current positions are remote work. You will not be required to travel.
      For more information about us, follow the links listed below.
      INT Official website
      Steam Greenlight
      IndieDB page
      Also follow social media platforms for the latest news regarding our projects.
      Facebook
      Twitter
       
      3D ANIMATOR
      We are looking for an Animator to join the Art team to rig characters and create animations for the game. You will be collaborating with fellow members of the team in the creation and polishing of 3D animations.
      Your tasks will include:
      Create rigs to be used for animations. Skin 3D models to rigs. Refine existing 3D animations. Contribute to constructive team discussions. Attend regular team meetings.  
       
      REQUIREMENTS
      To be successful in this position, following requirements apply:
      Have working knowledge of 3D animation suites. Understand import/export requirements for Unity Engine integration. Excellent self-management skills. Excellent attention to detail. Excellent communication skills. Satisfaction of the follow requirements are preferred, but not essential:
      Knowledge of the Unity Engine UMA character creation system would be an advantage.  
      REVENUE - SHARE
      This is the perfect opportunity to get into the game development industry. We have the majority of our art assets completed and are marching towards our crowd-funding campaign, currently planned for mid 2018.
      We are unable to offer wages or per-item payments at this time. However revenue-sharing from crowd-funding is offered to team members who contribute 15-20 hours per week to company projects, as well as maintain constant communication and adhere to deadlines. Your understanding is dearly appreciated.
       
      TO APPLY
      Please send your Cover Letter, CV, Portfolio (if applicable), and other relevant documents/information to this email: JohnHR@int-game.net
      Thank you for your time! Please feel free to contact me via the email provided should you have any questions. We look forward to hearing from you!
      John Shen
      HR Lead
      Starboard Games LLC
    • By adharsh anand
      hello, a friend and i are building a 2D platformer and i'd like to ask which software would be the best for 2D pixel animation
      (Moderator edit: changed the subject to be the question that needs answering -- Kylotan)
    • By Sung Woo Yeo
       
      Guys, I've spent a lot of time to load skeletal animation
      but  It is very difficult...
      I refer to http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html
      but I didn't get the results I wanted
       
      Please Help Me
       
      This is my codes
       
      void LoadAnimation::BoneTransform(float time, vector<XMFLOAT4X4>& transforms) { XMMATRIX Identity = XMMatrixIdentity(); float TicksPerSecond = (float)(m_pScene->mAnimations[0]->mTicksPerSecond != 0 ? m_pScene->mAnimations[0]->mTicksPerSecond : 25.0f); float TimeInTicks = time*TicksPerSecond; float AnimationTime = fmod(TimeInTicks, (float)m_pScene->mAnimations[0]->mDuration); ReadNodeHeirarchy(AnimationTime, m_pScene->mRootNode, Identity); transforms.resize(m_NumBones); for (int i = 0; i < m_NumBones; ++i) { XMStoreFloat4x4(&transforms[i], m_Bones[i].second.FinalTransformation); } } void LoadAnimation::ReadNodeHeirarchy(float AnimationTime, const aiNode * pNode, const XMMATRIX& ParentTransform) { string NodeName(pNode->mName.data); const aiAnimation* pAnim = m_pScene->mAnimations[0]; XMMATRIX NodeTransformation = XMMATRIX(&pNode->mTransformation.a1); const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnim, NodeName); if (pNodeAnim) { aiVector3D scaling; CalcInterpolatedScaling(scaling, AnimationTime, pNodeAnim); XMMATRIX ScalingM = XMMatrixScaling(scaling.x, scaling.y, scaling.z); ScalingM = XMMatrixTranspose(ScalingM); aiQuaternion q; CalcInterpolatedRotation(q, AnimationTime, pNodeAnim); XMMATRIX RotationM = XMMatrixRotationQuaternion(XMVectorSet(q.x, q.y, q.z, q.w)); RotationM = XMMatrixTranspose(RotationM); aiVector3D t; CalcInterpolatedPosition(t, AnimationTime, pNodeAnim); XMMATRIX TranslationM = XMMatrixTranslation(t.x, t.y, t.z); TranslationM = XMMatrixTranspose(TranslationM); NodeTransformation = TranslationM * RotationM * ScalingM; } XMMATRIX GlobalTransformation = ParentTransform * NodeTransformation; int tmp = 0; for (auto& p : m_Bones) { if (p.first == NodeName) { p.second.FinalTransformation = XMMatrixTranspose( m_GlobalInverse * GlobalTransformation * p.second.BoneOffset); break; } tmp += 1; } for (UINT i = 0; i < pNode->mNumChildren; ++i) { ReadNodeHeirarchy(AnimationTime, pNode->mChildren[i], GlobalTransformation); } }  
      CalcInterp~ function and Find~ function are like a tutorial
      (http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html)
       
      I think that I'm doing the multiplication wrong
      but I don't know where it went wrong
      If you want, i wall post other codes.
       
       here is my result
      (hands are stretched, legs are strange)

       
      and it is ideal result

  • Advertisement