Search Unity

Is There A Way To Have A Fluid Character?

Discussion in 'Animation' started by vertig02, Dec 8, 2017.

  1. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Hey there, Im new to Unity, what I mean is that, Im creating a first person game involving parkour and running mechanics complete with a character model, but Im not content with the stuff tutorials i found online are throwing at me. What they are telling me to do is assign an animation to something, an event for example. But the thing is I am NOT content with simply creating a character with animations, and assigning the animations to an event to give an illusion of what the player is doing (Example making a Player climb and playing a climb animation to give the illusion of climbing) It feels like my character is confined if i go that way, and there is no f***ing way for the life of me am i ever, EVER animating 500 different possible events. Nope. I feel like there is a way to make the character more fluid, for the Unity Physics Engine to be doing the job of moving the character's limbs and the character itself when they climb or whatever, instead of relying on a premade animation to do that. I also feel that by going this way Im making life easier for myself in the future as there's most likely a lot less work i have to do once I manage to find a fast way to do this. Does anyone know where I should start?
     
    Last edited: Dec 8, 2017
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    The best place you can go to make your life easier is to the learn section and documentation, and then into the editor to test things out.
    I say this - because it is very obvious you are very new to Unity and how animations are handled in the engine. Not saying your 'ideas' are bad or wrong, but without knowledge on the existing system, you will not understand how/why to improve the system, overcome some of the limitations you run into and create a controller the way you want.

    Also - check out FinalIK on the asset store. It is not free - but worth at least 4 times what the price is.
     
    vertig02 likes this.
  3. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Currently was doing that while i was reading your post Xd
    Eh, shouldnt be too hard to tell :p
    I dont quite understand; Is my idea not possible with Unity, or whether you are telling me to learn the animations system first before i do this? (Sorry if i dont sound friendly im trash at talking to people in a whole :p)

    Thing is I am not a fan of making a million animations and using it to give an illusion that the character is doing something when they actually are remaining still like what most people told me to, Im pretty sure it will be a lot harder to continue later on when the game is in a later stage of development too if i do this than if i actually do it with Physics or something
     
  4. nat42

    nat42

    Joined:
    Jun 10, 2017
    Posts:
    353
    What theANMATOR2b said, but also look at "active ragdolls" (EDIT: maybe check out David Rosen's GDC talk on Youtube too)

    As far as natural movent from physical simulation / first principles being 'easier' in the long run, in the general case... well if you solve that you should get a robotics job :p (but also prepare to read a lot of papers, for example you'll need to simulate the forces of human muscles and the nerves and feedback systems that control them)
     
    theANMATOR2b and vertig02 like this.
  5. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Hmm, thanks for the links :)



    But, it just feels really constrained using the animation to give the illusion of moving around. Im ready to read up lots about anything i have to learn if i do have to, be it how Unity's Animation Engine or whatever works to physical forces, anything to make this game look as best it can during runtime. I already learned that by rushing my work and doing the easy way out will most likely have bad results from other people who did the same thing, also being a Java guy it is kinda hard for me to go for the easy way out instead of taking time to learn and search for a better way :p
     
  6. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Still havent answered my question... is my idea possible in Unity one way or the other? (I have no qualms learning what i need to learn, I just want to know, and if it is where I should start from)
     
  7. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Hello?
     
  8. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    I'd look into procedural animation rather than physics based.

    https://docs.unity3d.com/ScriptReference/HumanPoseHandler.html would let you feed your procedurally generated poses to an avatar.
     
    vertig02 likes this.
  9. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Firstly, Thanks for the input! :)

    I have been researching, and found out about Root Motion, Inverse Kinematics, Procedural Animations Ragdolls, all the good stuff. What catches me is Root Motion, and what i am thinking of is a character without any premade animations, and a script that detects user input or any physics during runtime, then does an animation on the spot and doing some collider science, realistically moving the character. Is this idea rational, or some bullshit spouted by a guy who dosent know the first thing about animation (me)..?
     
    Last edited: Dec 10, 2017
  10. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    Root motion is normally related to a normal animation workflow rather than a procedural one. It's where the root position of the object has an animation track for it's movement.

    Instead of the player input moving the collider and having to match animation speed (the cartwheel thing in the video) to it, you could update the collider position based on the procedurally generated footsteps to mimic root motion. Which approach is best would depend on how you decide to generate the animation. For parkour where you might want to step from fence post to fence post, it might make more sense to work up from the footstep placement rather than down from the collider speed, in which case you would control the root motion based on the animation. Personally I'd try to keep physics for unexpected events, collisions, falls rather than having it as the main animation driver.

    Disclaimer: I've only thought about this stuff, not implemented it :)
     
    theANMATOR2b and vertig02 like this.
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Don't.
     
  12. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    ?

    EDIT: Oh xd
     
  13. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    Unless you are doing a parkour meets gangbeasts kinda thing of course :)
     
    vertig02 likes this.
  14. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Im really trying to do something like this:


    So what im guessing is that Procedural Animations are where Physics are done by a Script then the Collider and Model are moved and Animated directly on the spot by the Script according to some math with the help of IK, and there are absolutely NO premade Animations on the model?
     
  15. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Sorry - yes your idea is possible in Unity by a person who is experienced in the animation system, what it offers, and any limitations it has. Only then can a person really understand how to go beyond what is built into the mecanim system.
    This is why I suggested learning all you can before attempting to - do more than the animation system supports. You'll only end up confused and wondering if a certain function in the engine could do what you need instead of rolling your own.

    I believe this is overkill for what the OP really needs/wants. Yeah he said this is what he wants - but it is not what he needs. Good reference though.
    Also be aware - it took wolfire nearly 3 years to get that animation system up to snuff - I followed his development and from where it started - in a game called legario (or something) to where it started to take on the physical forms shown in that video, it was a solid 3 years of work. And that is from a guy who knows how to program animation systems - in his custom engine - not Unity.
    Also - the animation system they used (shown in the video) was largely panned by the user community. It may have worked like the developer wanted it to, but really didn't play well. It wasn't that fun, so - kinda missed the mark.

    Everything in that video is nothing more than common motion flow systems like mecanim populated by a bunch of animations - driven by events, variables, and trigger volumes. If that is what you want - the Unity animation system will work fine for your needs.
    The only thing that is not animations in that video is the death sequences - which are ragdolls.
     
    DominoM and vertig02 like this.
  16. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Wait, you mean like all those tutorials where you assign states and stuff in the Animator Controller and set booleans and triggers? Sounds surprising since it's very realistic and the player is able to aim their punches in any y rotation (aiming punches in any rotation except the y rotation works with the system that uses code to do all that stuff and plays the animations) What about the parkour and the weapon switching and the running? (According to some source the Game above was made with an Engine named Chrome Engine 6 if that helps)
     
  17. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    In the same way you can blend walks based on horizontal and vertical inputs, you could blend punch directions based on input. This is the same whether you use mechanim or generate the animation procedurally from a few key frames. Pretty much the only difference conceptually is the shift of inbetweening animation work from an artist to a programmer.

    There's quite a selection of Unity climbing system tutorials on youtube. Those are often a blend of mecanim and keyframe + ik systems so should give you a few ideas on how the two can be combined.
     
    theANMATOR2b and vertig02 like this.
  18. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    In any case though i would go with the solution that generates movement on runtime without any need for a predefined animation. Thanks a lot! Now tiem to go read up about all this :p
     
    DominoM likes this.
  19. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    Yeah.. When he basically stated in the video that he designed the controls for people who wanted to direct cinematic fight sequences I suspected as much. It's more a question of what the developers found fun than any issue with the animation techniques I think.
     
    theANMATOR2b likes this.
  20. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Another question tho, in the Rigidbody i usually see people have problems with the character falling over. Im wondering, can i use the system already built into the Rigidbody via C# Script for instances when the character is lying down (enemy attacks, falls, losing consciousness etc) instead of making my own?
     
  21. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    The ragdoll system makes it relatively easy to do deaths, but blending back into an animation is something you have to code (or buy on the asset store). Moving between crouched and prone is going to need animation of some form. "can I...?" is a question only you can answer..
     
    theANMATOR2b likes this.
  22. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    https://www.assetstore.unity3d.com/en/#!/content/48977

    But not for total beginners. Probably the most complete procedural animation system though, and handles ragdolls. Probably best to get a few months experience under your belt. You're trying to fly in a world where man runs and you haven't learned to walk.
     
    theANMATOR2b and vertig02 like this.
  23. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    I always have a bad habit of getting ahead of myself :p


    Probably why everyone questions why I wont take the easy way out when I do stuff Xd

    Probably just me being an idiot but falling down works with capsules, maybe with a little Scripting handling the character bones it'll work too :p Gonna have to research on the Rigidbody Component I guess
     
  24. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The problems you will encounter with physics engines come mostly from joints. Joints are not the same as IK joints or a hierarchy which will resolve. In Physx it depends massively on mass, iterations (especially iterations) and so on, and this will cause all manner of pain as the ragdoll fights itself, fights animation, tears itself apart etc. To solve this you really need to be using a special animation joint type like what UE4 and some other engines have, but Unity does not.

    So Unity needs a lot of massaging and care to get Physx to do jobs it shouldn't be doing (custom joints), unless you roll your own, and even then you'll have an uphill battle figuring out the best way to stop it fighting the actual animation.

    Haven't even mentioned how crap it is to work with joints in general within Unity. Or the quaternion-butchered madness that comes from hierarchical rotation transforms.

    I've been there, rolled my own and still got the scars!

    However, check out blend trees in mecanim. You can get a 2D blend tree to pretty much do anything like what you should be asking for, then just fall back to ragdoll for damage.
     
    vertig02 and theANMATOR2b like this.
  25. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Seems like Root Motion would be better for the mainframe while Ragdolls would be saved for instances that i cant have a predefined animation for?

    EDIT: What do you mean fight animation..? As in fighting predefined animations? What if in a certain phase it disables animations and then only enables Ragdoll Physics? Would that work?
     
    Last edited: Dec 12, 2017
  26. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's up to you. Stuff like puppetmaster can handle partial no problem. If it's your thing, just invest in an asset to do it for you since this is an area of game dev that will just drive you nuts without a math degree and a ton of experience.

    Even then it will probably be an area of dev that's troublesome.
     
    theANMATOR2b and vertig02 like this.
  27. vertig02

    vertig02

    Joined:
    Nov 30, 2017
    Posts:
    61
    Thanks, but...