Search Unity

Help about creating an animation that change

Discussion in 'Animation' started by AlexM117, Sep 21, 2020.

  1. AlexM117

    AlexM117

    Joined:
    Sep 21, 2020
    Posts:
    1
    Hello guys.
    I´m starting using Unity and I also use blender to create animations and models, but there is one animation that i dont know how works, let me explain... It is posible create in Blender or Unity an animation that could change depending the position or the form of and object ?
    For example: I want to create an animation to grab an object but this animation will be different depending about the position and the form of the object that my character want to grab.
    So there is a way to make that animation able to modify himself in order to grab the object no matter the form or the position where it is ?

    Thanks guys.
     
  2. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    This is quite an advanced topic, and will require some coding. Usually done inside Unity (except actually creating animation clips). Depending on the complexity of the task, either use Blend Trees https://docs.unity3d.com/Manual/class-BlendTree.html or Inverse Kinematics: https://docs.unity3d.com/Manual/InverseKinematics.html
    In easier case, when the maximum possible range of motion is known, you create 2 (or more) animations representing maximum and minimum of the arms' reach, put them into blend tree, then calculate the blend value in your script and assign it to your animation state machine as parameter. This parameter, in turn, drives the blend tree. When the exact range cannot be determined, then it is better to use Inverse Kinematics. You put the IK end targets on the surface of your object, then set the IK targets' weight to non-zero so the limbs snap to this object. Both can be combined since they are features of Mecanim animation system.