Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do I combine animations from 2 separate items?

Discussion in 'Scripting' started by kiop2336, Nov 4, 2018.

  1. kiop2336

    kiop2336

    Joined:
    Feb 6, 2013
    Posts:
    10
    So, I have been hitting a wall in my game. I would like to make my hands to interact with objects in the scenario, like a switch on the wall or opening a book, but I can't figure out how to:
    -Lock the character in a certain spot so the animations line up
    -How to make animations that connect the two objects
    For example the power switch in Cod WaW or the stealth takedowns from Far Cry

    I know this is a simple issue, please don't be a jerk and say that I need to "git gud" with my coding skills, I would rather a solution. Also! I am aware that is a lot to explain in comment, so links to related issues are fine.
    Thank you in advance!
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    i've never seen anybody here dismiss a question with "git gud noob", we're all here to help.(or get help)

    1) if you want to grab stuff dynamically(like reaching for a light switch or grabbing a book) look into IK(inverse kinematics), think of it like pulling the model by the arm toward the object.
    this is kind of a long video but it's got a lot of good info

    2) if you already have animation for all this stuff ready to go you can layer animations on top one another,
    https://docs.unity3d.com/Manual/class-BlendTree.html is a nice place to start

    hope this helps ;)
     
    kiop2336 likes this.
  3. kiop2336

    kiop2336

    Joined:
    Feb 6, 2013
    Posts:
    10

    Thanks a lot, I ended up deciding on a particular style thanks to your suggestion