public IEnumerator ScaleViaFarInteraction()
        {
            BoundsControl bbox = InstantiateSceneAndDefaultBbox();

            yield return(VerifyInitialBoundsCorrect(bbox));

            Vector3 rightCornerInteractionPoint = new Vector3(0.184f, 0.078f, 0.79f); // position of hand for far interacting with front right corner
            Vector3 pointOnCube = new Vector3(-0.033f, -0.129f, 0.499f);              // position where hand ray points on center of the test cube
            Vector3 scalePoint  = new Vector3(0.165f, 0.267f, 0.794f);                // end position for far interaction scaling

            TestHand hand = new TestHand(Handedness.Left);

            yield return(hand.Show(pointOnCube)); //initially make sure that hand ray is pointed on cube surface so we won't go behind the cube with our ray

            yield return(hand.MoveTo(rightCornerInteractionPoint));

            yield return(hand.SetGesture(ArticulatedHandPose.GestureId.Pinch));

            yield return(hand.MoveTo(scalePoint));

            var     endBounds      = bbox.GetComponent <BoxCollider>().bounds;
            Vector3 expectedCenter = new Vector3(0.0453f, 0.0453f, 1.455f);
            Vector3 expectedSize   = Vector3.one * 0.59f;

            TestUtilities.AssertAboutEqual(endBounds.center, expectedCenter, "endBounds incorrect center");
            TestUtilities.AssertAboutEqual(endBounds.size, expectedSize, "endBounds incorrect size");

            GameObject.Destroy(bbox.gameObject);
            // Wait for a frame to give Unity a change to actually destroy the object
            yield return(null);
        }
Beispiel #2
0
        private void OnEnable()
        {
            boundsControl = (BoundsControl)target;

            targetObject            = serializedObject.FindProperty("targetObject");
            activationType          = serializedObject.FindProperty("activation");
            boundsOverride          = serializedObject.FindProperty("boundsOverride");
            boundsCalculationMethod = serializedObject.FindProperty("boundsCalculationMethod");
            flattenAxis             = serializedObject.FindProperty("flattenAxis");
            controlPadding          = serializedObject.FindProperty("boxPadding");

            smoothingActive = serializedObject.FindProperty("smoothingActive");
            rotateLerpTime  = serializedObject.FindProperty("rotateLerpTime");
            scaleLerpTime   = serializedObject.FindProperty("scaleLerpTime");

            boxDisplayConfiguration      = serializedObject.FindProperty("boxDisplayConfiguration");
            linksConfiguration           = serializedObject.FindProperty("linksConfiguration");
            scaleHandlesConfiguration    = serializedObject.FindProperty("scaleHandlesConfiguration");
            rotationHandlesConfiguration = serializedObject.FindProperty("rotationHandlesConfiguration");
            proximityEffectConfiguration = serializedObject.FindProperty("handleProximityEffectConfiguration");

            hideElementsInHierarchyEditor = serializedObject.FindProperty("hideElementsInInspector");

            rotateStartedEvent = serializedObject.FindProperty("rotateStarted");
            rotateStoppedEvent = serializedObject.FindProperty("rotateStopped");
            scaleStartedEvent  = serializedObject.FindProperty("scaleStarted");
            scaleStoppedEvent  = serializedObject.FindProperty("scaleStopped");
        }
Beispiel #3
0
        private void Awake()
        {
            Debug.Assert(mrtkStandardMaterial);

            objectManipulator = gameObject.GetComponent <ObjectManipulator>();
            boundsControl     = gameObject.GetComponent <BoundsControl>();

            gltfAsset = gameObject.GetComponent <GltfAsset>();
            gltfAsset.onLoadComplete += OnLoadComplete;
        }
        private void Start()
        {
            _mainCamera = Camera.main;

            //
            // Find bounding box components.
            //
            _searchAreaBboxManipulationHandler = GetComponent <ObjectManipulator>();
            _searchAreaBboxManipulationHandler.OnManipulationEnded.AddListener(BoundingBoxMoved);
            _searchAreaBounds          = GetComponent <BoundsControl>();
            _objectAnchorsService      = ObjectAnchorsService.GetService();
            _trackableObjectDataLoader = TrackableObjectDataLoader.Instance;
            _trackableObjectDataLoader.ModelsLoaded += _trackableObjectDataLoader_ModelsLoaded;
            _automaticSearchAreaMovementController   = GetComponent <AutonomousSearchArea>();
            _searchAreaModelVisualization            = GetComponentInChildren <SearchAreaModelVisualization>();
        }