Skip to main content
March 6, 2020
Solved

OVRInput data only provides numbers in with one decimal

  • March 6, 2020
  • 3 replies
  • 1327 views
Good morning guys,

Right now, we're developing games in Oculus Quest and we would like to output position, velocity, acceleration data for data analysis. However, it appears that the data output from Oculus Quest is only in one decimal numbers (e.g. 0.1, 5.8). Below is the code I'm using, does anyone have the same problem or know how to solve this problem?

lp = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch);
lv = OVRInput.GetLocalControllerVelocity(OVRInput.Controller.LTouch);
la = OVRInput.GetLocalControllerAcceleration(OVRInput.Controller.LTouch);
lav = OVRInput.GetLocalControllerAngularVelocity(OVRInput.Controller.LTouch);
laa = OVRInput.GetLocalControllerAngularAcceleration(OVRInput.Controller.LTouch);
lr = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);
rp = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch);
rv = OVRInput.GetLocalControllerVelocity(OVRInput.Controller.RTouch);
ra = OVRInput.GetLocalControllerAcceleration(OVRInput.Controller.RTouch);
rav = OVRInput.GetLocalControllerAngularVelocity(OVRInput.Controller.RTouch);
raa = OVRInput.GetLocalControllerAngularAcceleration(OVRInput.Controller.RTouch);
rr = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);
touchl.localPosition=lp;
touchr.localPosition=rp;
string t= DateTime.Now.ToString("yyyyMMdd_HH-mm-ss.fff tt");
string data = string.Format("\n{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", t, lp.ToString(), rp.ToString(), lv.ToString(), rv.ToString(), la.ToString(), ra.ToString());
    Best answer by kojack
    Unity's Vector3.ToString() only displays 1 digit after the decimal point regardless of the actual value. So the values are correct, it's just the string output that is truncating vectors to look neater.

    Try using ToString("F3") instead, that will show 3 digits.

    3 replies

    Inspiring
    March 6, 2020
    Probably the wrong place to ask try over at the developer forum


    kojackAnswer
    Honored Contributor
    March 6, 2020
    Unity's Vector3.ToString() only displays 1 digit after the decimal point regardless of the actual value. So the values are correct, it's just the string output that is truncating vectors to look neater.

    Try using ToString("F3") instead, that will show 3 digits.

    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    March 10, 2020

    kojack said:

    Unity's Vector3.ToString() only displays 1 digit after the decimal point regardless of the actual value. So the values are correct, it's just the string output that is truncating vectors to look neater.

    Try using ToString("F3") instead, that will show 3 digits.



    Thank you! This kinda explains why vector.x.ToString() gives me more decimals when applicable.....