0
\$\begingroup\$

Back when I used Unity 2017 and controller bindings weren't a thing, I simply attached a rigidbody to my Vive controller and read out the velocity of the rigidbody to know how fast the player was swinging the controller. Now, I've updated to Unity 2021.2.0a14, I went through all the effort of modifying my code to work with bindings, and it doesn't seem like I can get velocity anymore. The rigidbody always reports zero velocity. I can see the World Center of Mass vector changing so I know it registers motion, but it's just not reporting the velocity anymore. Is there a new setting in Unity I need to turn on to measure things that it doesn't personally control? Or do the new bindings options have a way to get velocity as an input? Am I forced to calculate it myself now? Thanks!

Edit: Base assumption was wrong, I did not get velocity from the rigidbody attached to the hand controller like I thought I did. I got it directly from SteamVR_Controller. So Unity is probably acting like it ever did.

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$
    public SteamVR_Action_Pose PoseAction; //initialized via inspector to a pose action
    public SteamVR_Input_Sources controller; // also initialized via inspector
     
    public void Start()
    {
        PoseAction.AddOnUpdateListener(controller, PoseUpdate);
    }

    public void PoseUpdate(SteamVR_Action_Pose fromAction, SteamVR_Input_Sources fromSource)
    {
        Debug.Log(fromSource.velocity);
    }
```
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .