Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug Animating hand models.

Discussion in 'VR' started by Iceman420, Aug 23, 2022.

  1. Iceman420

    Iceman420

    Joined:
    Oct 28, 2021
    Posts:
    15
    Hi all :)
    I'm trying to animate the hands I created in blender and imported to Unity and I'm using the XR integration toolkit. As you can see in the video I'm reading the input from the controller and setting it in the blend tree but I can't see the animations in play time.
    Maybe someone could advise ?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6.  
    7. public class HandsController_2 : MonoBehaviour
    8. {
    9.     [SerializeField]
    10.     private InputActionProperty pinchAnimationAction;
    11.     [SerializeField]
    12.     private InputActionProperty gripAnimationAction;
    13.     private Animator handsAnimator;
    14.     private string gripParameterName = "Grip";
    15.     private string triggerParameterName = "Trigger";
    16.  
    17.  
    18.     private void Awake()
    19.     {
    20.         handsAnimator = this.gameObject.GetComponent<Animator>();
    21.     }
    22.    
    23.     void Update()
    24.     {
    25.         float triggerValue = pinchAnimationAction.action.ReadValue<float>();
    26.         handsAnimator.SetFloat(triggerParameterName,triggerValue);
    27.  
    28.  
    29.         Debug.Log(triggerValue);
    30.  
    31.  
    32.         float gripValue = gripAnimationAction.action.ReadValue<float>();
    33.         handsAnimator.SetFloat(gripParameterName, gripValue);
    34.  
    35.  
    36.     }
    37. }
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,025
    I personally used this guide with success:
     
  3. Iceman420

    Iceman420

    Joined:
    Oct 28, 2021
    Posts:
    15
    Hi tried to fallow this tutorial without success :(
    I think I have a problem with my Animator.
    In this video, you can see that when I change the animation parameters, I can see the animation preview but in play mode (in this video it's not in my "VR mode" of the project) it doesn't work properly...what am I missing ?

     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,025
    Did you watch the full video? He goes over the looping issue in the troubleshooting section
     
  5. Iceman420

    Iceman420

    Joined:
    Oct 28, 2021
    Posts:
    15
    Yes I watched it, but my problem is different, I can't see the animation at all it's not just the looping problem.
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,025
    It does show in scene view, right?
    Just not game view?
    Maybe you are viewing the wrong hand in game view?
     
  7. Iceman420

    Iceman420

    Joined:
    Oct 28, 2021
    Posts:
    15
    In game view (With headset on) I can see the hand moving with the controller, but pressing grab/trigger only change the parameters in the blend tree and I can't see the animation.
     
  8. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,025
    What?
    Check if the controllers and animations are properly linked and test if the code itself worked