Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Malbers Horse Animset Pro v 4.06

Discussion in 'Assets and Asset Store' started by rbrodt, Feb 1, 2020.

  1. rbrodt

    rbrodt

    Joined:
    Aug 4, 2017
    Posts:
    4
    [SOLVED]

    Hello Malbers!

    Just purchased your Horse Animset Pro package - good stuff! I'm kind of new to Unity and I'm trying to figure out how to hook up a VR headset controller to the animal input system. I tried to follow along with the tutorials and the documentation you have on your website but couldn't find anything that uses the "Input" (instead of "Key") type. I got as far as being able to change State from Idle to Locomotion, but can't get beyond that. I can't figure out how to set the speed (Walk, Trot, Gallop etc.)

    So, I created a new Input row called "Walk" in the Malbers Input component and set its type to "Input". In the Walk Properties, I configured the OnInputPressed event handler to call MAnimal.State_Activate() with "Locomotion". I then created a custom IInputSystem class like so:

    Code (CSharp):
    1.  
    2.     class VRControllerInputSystem : IInputSystem
    3.     {
    4.         ...
    5.  
    6.         public bool GetButton(string button)
    7.         {
    8.             if (button == "Walk")
    9.             {
    10.                 if (myVRController.TriggerIsPressed())
    11.                 {
    12.                     return true;
    13.                 }
    14.             }
    15.             return false;
    16.         }
    17.         ...
    18.     }
    19.  
    and set the InputRow's inputSystem during startup:

    Code (CSharp):
    1.  
    2. public class VRHeadsetInputController : MonoBehaviour
    3. {
    4.     public MalbersAnimations.MalbersInput malbersInput;
    5.  
    6.     void Start()
    7.     {
    8.         inputSystem = new VRControllerInputSystem();
    9.  
    10.         InputRow ir = malbersInput.FindInput("Walk");
    11.         if (ir != null)
    12.         {
    13.             ir.InputSystem = inputSystem;
    14.         }
    15.     }
    16. }
    17.  
    I can verify the State is changed to Locomotion (I can see state change in the Animator window) but the horse doesn't move. Just for fun, I changed the InputRow Name and Value to "Jump", and the horse does indeed perform the Jump animation.

    Am I on the right track here, or totally off in the weeds?

    Thanks in advance!
    Bob

    EDIT:

    Never mind, I figured it out from one of your previous posts: the answer is to:
    1. change state to "Locomotion": MAnimal.State_Activate(Locomotion_State_ID);
    2. set the speed to "Walk" from the "Ground" speed set: MAnimal.Speed_Set(1);
    3. in a script determine which direction you want to go and call MAnimal.Move(Vector2 or Vector3)
     
    Last edited: Feb 5, 2020
    Malbers likes this.