Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Humerus · Feb 20, 2017 at 07:38 PM · animationcollisionwalkingmoveposition

Best way to make walking animation interact with terrain

Hello!

I've created a custom creature made out of cubes that I've been trying to animate. I wish to make it walk in such a way that it's legs would interact with terrain (for example, they would stand on top of smaller obstacles on the path instead of warping through them) but make it not actually influence the movement of the entire thing (I wish to keep that handled seperately).

My current setup involves the "torso" and "feet", with the legs in between rigged up with character and hinge joints. alt text

So far I've tried making an animation using the Unity's animation tab, but I was unable to make the legs interact the way as described above.

I'm currently working on animating it using the .MovePosition, where I give each foot 4 points determined by a Vector 3 relative to the parent "torso" and make it cycle through them. It's been pretty successfull but I noticed that the points do not update apropriately if I rotate the whole thing (they instead continue walking in a crab-like fashion).

I would appreciate if anyone has any suggestions for either approach.

palk1.png (243.9 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by HenryStrattonFW · Feb 20, 2017 at 08:51 PM

To my knowledge there are two approaches you could use here, the first is a lot simpler, and may provide you with enough, the second is far more complex, in any case I'll just give a brief overview here since otherwise it could be an insanely long post.

  1. Have a standard movement animation, you let the animation play, and then after the animator does its thing you jump in (during LateUpdate), raycast to find the "floor" position for each foot, and then use some IK to then adjust the rest of the limb based on the joints. Unity does have some IK stuff built in I think as part of mecanim (please someone correct me if I'm wrong there) but not sure if it work on non-humanoid rigs (again, not much experience with that so again anyone with more info please chime in).

  2. Do all of the animation procedural. Now this I've had to do before for spiders and here's how it breaks down. you have to have a means of calculating the "arc" that you want a foot to travel, then by means of an update coroutine or some other method, you move a given foot (depending on which feet are active at any time) along the arc (and as before, use IK to correct the rest of the limb after setting the new foot position), each time checking to see if you've come into contact with the floor, if so, that foot is marked as grounded and you wait until the next footstep time for that particular foot, rinse and repeat. This can be a really cool way to move creatures as you can get all sorts of control over the gait (the pattern/style of the walk) by controlling variables like making the arcs longer, shorter, taller, flatter, less or more time between each legs steps and the step speed itself. That all being said, this method is a hell of a lot more complex, and can result in some really interesting visual bugs later down the line (something I often referred to for the spiders as "space-squidding").

Sorry for not going into more detail, but hopefully this gives you an idea of some options, and perhaps someone else can chime in with more ideas If there's something I missed (there's always something I miss).

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Humerus · Feb 20, 2017 at 09:57 PM 0
Share

Thank you for the reply. I think I'll do some research about I$$anonymous$$ and animators and try your first suggestion.

The second approach sounds like an intersting idea, but probably too complex for my current knowledge and needs. I would be very interested in any examples of it, however, to maybe try and revisit at some point.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to detect for collisions and run scripts on other objects during specific animation frames? 1 Answer

How to get the first person controller to collide with an animated object? 1 Answer

is there a way to move a rigidbody with something like moveposition without clipping through collider? 1 Answer

Mixamo Animation: How to rotate my character while walking? 0 Answers

Stop animation when character controller hits walls 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges