@@ -381,12 +381,12 @@ public IEnumerator ScaleHandlesOnProximity()
381381 proximityConfig . FarGrowRate = 1.0f ;
382382 bbox . CreateRig ( ) ;
383383 yield return null ; // wait so rig gameobjects get recreated
384- yield return TestCurrentProximityConfiguration ( bbox , hand ) ;
384+ yield return TestCurrentProximityConfiguration ( bbox , hand , "Defaults" ) ;
385385
386386 // reset hand
387387 yield return hand . MoveTo ( initialHandPosition ) ;
388388
389- //--- 3. now test custom configuration is applied during runtime
389+ //--- 3. now test custom configuration is applied during runtime - max proximity values
390390 proximityConfig . CloseScale = 4.0f ;
391391 proximityConfig . MediumScale = 3.0f ;
392392 proximityConfig . FarScale = 2.0f ;
@@ -396,7 +396,18 @@ public IEnumerator ScaleHandlesOnProximity()
396396
397397 bbox . CreateRig ( ) ;
398398 yield return null ; // wait so rig gameobjects get recreated
399- yield return TestCurrentProximityConfiguration ( bbox , hand ) ;
399+ yield return TestCurrentProximityConfiguration ( bbox , hand , "Custom runtime config max" ) ;
400+
401+ // reset hand
402+ yield return hand . MoveTo ( initialHandPosition ) ;
403+
404+ //--- 4. custom config - min values
405+ proximityConfig . ObjectMediumProximity = 0.005f ;
406+ proximityConfig . ObjectCloseProximity = 0.001f ;
407+
408+ bbox . CreateRig ( ) ;
409+ yield return null ; // wait so rig gameobjects get recreated
410+ yield return TestCurrentProximityConfiguration ( bbox , hand , "Custom runtime config min" ) ;
400411 }
401412
402413
@@ -405,49 +416,55 @@ public IEnumerator ScaleHandlesOnProximity()
405416 /// </summary>
406417 /// <param name="bbox">Bounds Control to test on</param>
407418 /// <param name="hand">Test hand to use for testing proximity to handle</param>
408- private IEnumerator TestCurrentProximityConfiguration ( BoundsControl bbox , TestHand hand )
419+ private IEnumerator TestCurrentProximityConfiguration ( BoundsControl bbox , TestHand hand , string testDescription )
409420 {
421+ const float handOffset = 0.036718f ; // TODO : THIS OFFSET IS STILL WRONG!
422+
410423 // get config and scaling handle
411424 ScaleHandlesConfiguration scaleHandleConfig = bbox . ScaleHandlesConfiguration ;
412425 Vector3 defaultHandleSize = Vector3 . one * scaleHandleConfig . HandleSize ;
413426 Transform scaleHandle = bbox . gameObject . transform . Find ( "rigRoot/corner_3" ) ;
414427 Transform proximityScaledVisual = scaleHandle . GetChild ( 0 ) ? . GetChild ( 0 ) ;
415428 var frontRightCornerPos = scaleHandle . position ;
429+ // compensate for hand offset
430+ frontRightCornerPos . y += handOffset ;
416431
417432 //yield return null;
418433
419434 // check far scale applied
420435 ProximityEffectConfiguration proximityConfig = bbox . HandleProximityEffectConfiguration ;
421436 Vector3 expectedFarScale = defaultHandleSize * proximityConfig . FarScale ;
422- Assert . AreEqual ( proximityScaledVisual . localScale , expectedFarScale , "Proximity far scale wasn't applied to handle" ) ;
437+ yield return PlayModeTestUtilities . WaitForEnterKey ( ) ;
438+ Assert . AreEqual ( proximityScaledVisual . localScale , expectedFarScale , testDescription + " - Proximity far scale wasn't applied to handle" ) ;
423439
424440 // move into medium range and check if scale was applied
425441 Vector3 mediumProximityTestDist = frontRightCornerPos ;
426- mediumProximityTestDist . x += ( proximityConfig . ObjectMediumProximity ) ;
442+ mediumProximityTestDist . x += proximityConfig . ObjectMediumProximity ;
427443 yield return hand . MoveTo ( mediumProximityTestDist , 50 ) ;
428444 yield return PlayModeTestUtilities . WaitForEnterKey ( ) ;
429445 Vector3 expectedMediumScale = defaultHandleSize * proximityConfig . MediumScale ;
430- Assert . AreEqual ( proximityScaledVisual . localScale , expectedMediumScale , " Proximity medium scale wasn't applied to handle") ;
446+ Assert . AreEqual ( proximityScaledVisual . localScale , expectedMediumScale , testDescription + " - Proximity medium scale wasn't applied to handle") ;
431447
432448 // move into close scale range and check if scale was applied
433449 Vector3 closeProximityTestDir = frontRightCornerPos ;
434450 closeProximityTestDir . x += proximityConfig . ObjectCloseProximity ;
435451 yield return hand . MoveTo ( closeProximityTestDir ) ;
436452 Vector3 expectedCloseScale = defaultHandleSize * proximityConfig . CloseScale ;
437- Assert . AreEqual ( proximityScaledVisual . localScale , expectedCloseScale , "Proximity close scale wasn't applied to handle" ) ;
453+ yield return PlayModeTestUtilities . WaitForEnterKey ( ) ;
454+ Assert . AreEqual ( proximityScaledVisual . localScale , expectedCloseScale , testDescription + " - Proximity close scale wasn't applied to handle" ) ;
438455
439- const float moveOutOfScaleConstant = 0.01f ;
456+ float moveOutOfScaleConstant = proximityConfig . ObjectCloseProximity ;
440457 // move out of close scale again - should fall back to medium proximity
441458 closeProximityTestDir . x += moveOutOfScaleConstant ;
442459 yield return hand . MoveTo ( closeProximityTestDir ) ;
443460 yield return PlayModeTestUtilities . WaitForEnterKey ( ) ;
444- Assert . AreEqual ( proximityScaledVisual . localScale , expectedMediumScale , " Proximity medium scale wasn't applied to handle") ;
461+ Assert . AreEqual ( proximityScaledVisual . localScale , expectedMediumScale , testDescription + " - Proximity medium scale wasn't applied to handle") ;
445462
446463 // move slightly out of medium proximity and check if far scaling is applied
447464 mediumProximityTestDist . x += moveOutOfScaleConstant ;
448465 yield return hand . MoveTo ( mediumProximityTestDist ) ;
449466 yield return PlayModeTestUtilities . WaitForEnterKey ( ) ;
450- Assert . AreEqual ( proximityScaledVisual . localScale , expectedFarScale , " Proximity far scale wasn't applied to handle") ;
467+ Assert . AreEqual ( proximityScaledVisual . localScale , expectedFarScale , testDescription + " - Proximity far scale wasn't applied to handle") ;
451468
452469 yield return null ;
453470 }
0 commit comments