Esempio n. 1
0
        protected virtual void Start()
        {
            // Make sure we have all the components in the scene we need.
            anchorManager = WorldAnchorManager.Instance;
            if (anchorManager == null)
            {
                Debug.LogError("This script expects that you have a WorldAnchorManager component in your scene.");
            }

            spatialMappingManager = SpatialMappingManager.Instance;
            if (spatialMappingManager == null)
            {
                Debug.LogError("This script expects that you have a SpatialMappingManager component in your scene.");
            }

            if (anchorManager != null && spatialMappingManager != null)
            {
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
            }
            else
            {
                // If we don't have what we need to proceed, we may as well remove ourselves.
                Destroy(this);
            }

            if (PlaceParentOnTap)
            {
                if (ParentGameObjectToPlace != null && !gameObject.transform.IsChildOf(ParentGameObjectToPlace.transform))
                {
                    Debug.LogError("The specified parent object is not a parent of this object.");
                }

                DetermineParent();
            }
        }
        private void Start()
        {
            DetermineParent();
            if (SavedAnchorFriendlyName == string.Empty)
            {
                SavedAnchorFriendlyName = this.ObjectToPlace.name;
            }

            mainCamera = Camera.main;

            if (EnablePersistenceInWorldAnchor)
            {
                // Make sure we have all the components in the scene we need.
                anchorManager = WorldAnchorManager.Instance;
                if (anchorManager == null)
                {
                    Debug.LogError("The EnablePersistenceInWorldAnchor flag expects that you have a WorldAnchorManager component in your scene.");
                }
            }

            if (EnablePersistenceInWorldAnchor || Placement == PlacementOptions.ForceSpatialMapping || Placement == PlacementOptions.FreeAndSpatialMapping)
            {
                // Make sure we have all the components in the scene we need.
                spatialMappingManager = SpatialMappingManager.Instance;
                if (spatialMappingManager == null)
                {
                    Debug.LogError("The EnablePersistenceInWorldAnchor and Placement " + Placement.ToString() + " flags and expects that you have a SpatialMappingManager component in your scene.");
                }
            }

            if (anchorManager != null && spatialMappingManager != null)
            {
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
            }
        }
        protected virtual void Start()
        {
            localPositionOffset = gameObject.transform.localPosition;  // Save Offset for reconnection

            appShareControl = AppShareControl.Instance;
            if (appShareControl == null)
            {
                Debug.LogError("TapToPlace2: Requires AppShareControl");
            }

            spatialMappingManager = SpatialMappingManager.Instance;
            if (spatialMappingManager == null)
            {
                Debug.LogError("This script expects that you have a SpatialMappingManager component in your scene.");
            }

            //if (PlaceParentOnTap)
            //{
            //    if (ParentGameObjectToPlace != null && !gameObject.transform.IsChildOf(ParentGameObjectToPlace.transform))
            //    {
            //        Debug.LogError("The specified parent object is not a parent of this object.");
            //    }

            //    DetermineParent();
            //}
        }
    // Use this for initialization
    void Start()
    {
        // Setup fallback handler for hand gestures
        InputManager.Instance.PushFallbackInputHandler(gameObject);

        SpatialMappingManager = SpatialMapping.GetComponent <HoloToolkit.Unity.SpatialMapping.SpatialMappingManager>();
        // Store list of lines
        lineGeneratorList = new List <GameObject>();
    }
Esempio n. 5
0
        protected virtual void Start()
        {
            //状态机绑定


            ver1 = transform.position; ///////////////////

            Lerpfirst.OnUpdate = LerpUpdat;

            move.OnEnter  = OnInputClicked;
            move.OnUpdate = MoveUpdate;
            move.OnLeave  = OnInputClicked;

            rotate.OnEnter = EnterRotate;
            rotate.OnLeave = LeaveRoate;

            changecolor.OnLeave = LeaveChangColor;

            delet.OnEnter = Delet;

            //初始化状态
            // STATE = ido;

            selfmaterial = GetComponentInChildren <MeshRenderer>().material;

            Debug.Log(selfmaterial);
            //   WorldSpaceUI.Instance.e_tap += HitOnMe;

            // Make sure we have all the components in the scene we need.
            anchorManager = WorldAnchorManager.Instance;
            if (anchorManager == null)
            {
                Debug.LogError("This script expects that you have a WorldAnchorManager component in your scene.");
            }

            spatialMappingManager = SpatialMappingManager.Instance;
            if (spatialMappingManager == null)
            {
                Debug.LogError("This script expects that you have a SpatialMappingManager component in your scene.");
            }

            if (anchorManager != null && spatialMappingManager != null)
            {
                // If we are not starting out with actively placing the object, give it a World Anchor
                if (!IsBeingPlaced)
                {
                    //    anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
                }
            }
            else
            {
                // If we don't have what we need to proceed, we may as well remove ourselves.
                Destroy(this);
            }

            if (PlaceParentOnTap)
            {
                if (ParentGameObjectToPlace != null && !gameObject.transform.IsChildOf(ParentGameObjectToPlace.transform))
                {
                    Debug.LogError("The specified parent object is not a parent of this object.");
                }

                DetermineParent();
            }
            if (transform.Find("id_debuggertext") != null)
            {
                id_debuggertext       = transform.Find("id_debuggertext").GetComponent <TextMesh>();
                localpos_debuggertext = transform.Find("localpos_debuggertext").GetComponent <TextMesh>();
                id_debuggertext.text  = "我的ID::" + myID.ToString();
            }
        }
 //Set Private internals
 protected virtual void Start()
 {
     spatialMappingManager     = SpatialMappingManager.Instance;
     default_placeholder_scale = Placeholder.transform.localScale;
 }