コード例 #1
0
ファイル: AppState.cs プロジェクト: johnmockler/Registrate
 public bool AddNewTarget()
 {
     /*
      * if(this.targets_placed == 0)
      * {
      *  this.placedTargets[this.targets_placed] = SpatialAwarenessInterface.PlaceObject(_objectToPlaceAnimated);
      *  //perform initial animation
      *
      * }
      * else
      * {
      *  this.placedTargets[this.targets_placed] = SpatialAwarenessInterface.PlaceObject(_objectToPlace);
      * }
      */
     this.placedTargets[this.targetsPlaced] = SpatialAwarenessInterface.PlaceObject(_objectToPlace);
     if (this.placedTargets[this.targetsPlaced] != null)
     {
         initialPlacement = this.placedTargets[this.targetsPlaced].transform.position;
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
    void Update()
    {
        Vector3 lookBack = Camera.main.transform.rotation.eulerAngles;

        lookBack.x  = lookBack.z = 0f;
        lookBack.y += 180f;

        Vector3?positionToPlace = SpatialAwarenessInterface.GetPositionOnSpatialMap();

        if (positionToPlace != null)
        {
            this.transform.position = positionToPlace.Value;
        }
        else
        {
            Ray headRay = new Ray(transform.position, transform.forward);
            this.transform.position = headRay.GetPoint(2);
        }

        this.transform.rotation = Quaternion.Euler(lookBack);
    }
コード例 #3
0
    public void OnEnter(InputAction.CallbackContext context)
    {
        if (context.started == true)
        {
            if (!placingMap)
            {
                sounds.PlayClip("enter");

                switch (selectedOption)
                {
                case 1:
                    placeMapOnMesh();
                    break;

                case 2:
                    resetCalibration();
                    break;
                }
            }
            else
            {
                //instantiate map on spatial mesh

                popOutModel = SpatialAwarenessInterface.PlaceObject(placeableMap);

                if (popOutModel != null)
                {
                    sounds.PlayClip("target placed");
                    menuDisplay.SetActive(true);
                    cursor.SetActive(false);
                    placingMap = false;
                    controlTips.SetActive(false);
                }
                else
                {
                    sounds.PlayClip("enter failed");
                }
            }
        }
    }