MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Invalid coords for TryGetPosition and TryGetRotation

Open hridpath opened this issue 9 years ago • 8 comments

In the Unity.XR.WSA.Input.InteractionSourcePose the TryGet functions can return a true value with corrdinates in the results having a NaN value. I have created a Bug Report to Unity and waiting on the results. This may be intentional on their part so inorder to prevent errors when using the output of these methods, A NaN check should be done prior to using the values.

As a Temporary fix the following code can be used allong with these TryGet functions. Here is a snippit of code to fix this in teh MotionControllerVisualizer.cs mcv_validpos_rot

hridpath avatar Nov 02 '17 22:11 hridpath

I think there's a simpler way to check if the value is valid at all, including infinity

StephenHodgson avatar Nov 02 '17 22:11 StephenHodgson

TryParse by converting the value ToSting() would cover the infinity, but this can be very expensive in an Update. @StephenHodgson Do you think that Infinity would be invalid in this case with the Motion Controller?

hridpath avatar Nov 02 '17 22:11 hridpath

Why wouldn't float.IsInfinity(newPosition.y) not work?

StephenHodgson avatar Nov 03 '17 00:11 StephenHodgson

Why do we need to check IsInfinity?

keveleigh avatar Nov 03 '17 00:11 keveleigh

Who know's. We're getting NaNs so there is the possibility

StephenHodgson avatar Nov 03 '17 00:11 StephenHodgson

The IsInfinity check can be included in the return expression. Would you consider Infinity an invalid value to set a Position or Rotation??

hridpath avatar Nov 03 '17 18:11 hridpath

@hridpath were you going to submit a PR for this?

StephenHodgson avatar Nov 13 '17 23:11 StephenHodgson

Looks like GitHub didn't automatically close these issues when merged into master. I'll close these manually and look into why.

keveleigh avatar Dec 29 '17 00:12 keveleigh