Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
6 years ago
Solved

OVRInput data only provides numbers in with one decimal

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());
  • 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

  • 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.

  • Anonymous's avatar
    Anonymous

    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.....