Your participation on the forum is subject to the

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums will be revoked at the discretion of Oculus staff.

TheStonefox
Posts: **10** NerveGear

Hi all,

I'm trying to affect a rigidbody's angular velocity (which is a Vector3) based on the current angular velocity of the touch controller.

OVRInput has a GetLocalControllerAngularVelocity method but this returns a Quaternion and not a Vector3.

If I get the Eular from the returned quaternion then it's a really high number (i'm guessing it's in degrees as well) which means the rotation is way too high when affecting the rigidbody's angular velocity.

I've also tried converting the eular to radians but that doesn't seem to work correctly either.

Does anyone know how you can get the angular velocity of the controller and apply it to a rigidbody's angular velocity?

I'm trying to affect a rigidbody's angular velocity (which is a Vector3) based on the current angular velocity of the touch controller.

OVRInput has a GetLocalControllerAngularVelocity method but this returns a Quaternion and not a Vector3.

If I get the Eular from the returned quaternion then it's a really high number (i'm guessing it's in degrees as well) which means the rotation is way too high when affecting the rigidbody's angular velocity.

I've also tried converting the eular to radians but that doesn't seem to work correctly either.

Does anyone know how you can get the angular velocity of the controller and apply it to a rigidbody's angular velocity?

Tagged:

0

It looks like you're new here. If you want to get involved, click one of these buttons!

## Comments

1,596Oculus StaffCan you give some example numbers? There is a known issue with OVRInput.GetLocalControllerAngularVelocity(..) that results in the value being clamped to (0, 2*pi) because of the use of quaternions, but I haven't heard any cases of excessively high numbers. This should be fixed in our next (late-January) release, but you can work around it for now by finding the difference between the controller's current and previous rotation and dividing by Time.deltaTime.

10NerveGearand when I get the eular from it (with result.eular) I get [301.0, 144.8, 221.3]

As you can see those eular angles are very high for angular velocities, which causes the objects to just spin crazily.

Are you saying then at the moment to not use GetLocalControllerAngularVelocity and to get the controller's current rotation eular, and previous rotation then getting the delta of the two (b-a) and dividing by delta time?

1,596Oculus StaffAs you mentioned, those numbers are in degrees, so the object is rotation less than one revolution per second around each axis and should not spin crazily.

> get the controller's current rotation eular, and previous rotation then getting the delta of the two (b-a) and dividing by delta time?

It depends on your use case. The problem right now is that the angular velocity gets capped at one revolution per second about any axis. If you are making a game such as darts, the bug may not affect you. For spin-the-bottle, it may limit the bottle's rotation speed.

10NerveGearI can get the velocity to work fine using `GetLocalControllerVelocity` but I just can't get the Angular Velocity.

1,596Oculus Staff10NerveGearHere is an example of how I've tried the conversion:

var velocity = (OVRInput.GetLocalControllerAngularVelocity(touchControllers[device.index]).eulerAngles * Mathf.Deg2Rad);

and also:

var velocity = (OVRInput.GetLocalControllerAngularVelocity(touchControllers[device.index]).eulerAngles * (Mathf.pi / 180f));

1,596Oculus Staff10NerveGear17Oculus Start Member10NerveGear91Oculus Start Member3,587Valuable PlayerThis is still road-mapped to be fixed in the future, but it is worth nothing that at this time a number of more critical problems with angular velocity and acceleration have been fixed which should make them usable today.

91Oculus Start Member52Hiro ProtagonistI wrote a grab/carry/drop script, yet now working on the throw...and already WAAAAAAAAAY over spending days on something that SHOULD be included in the Gear VR sdk for Unity...

91Oculus Start Member4,546Valuable PlayerI've just picked Unity up again after a long time off and noticed a lot of things i used to have to use scripts for are built-in. I'm just seeing how far i can go without scripts. Thanks.