void adjust()
        {
            Vector3 current = currentLocation.convertCoordinateToVector();
            Vector3 v       = current;

            currentLocation = Coordinates.convertVectorToCoordinates(v);
            //          v = current + new Vector3(0, 0 , 0.1f)*worldScale;
            currentLocation = Coordinates.convertVectorToCoordinates(v);

            switch (motionMode)
            {
            case MotionMode.Avatar:
                if (onOriginSet != null)
                {
                    onOriginSet.Invoke(currentLocation);
                }
                break;

            case MotionMode.GPS:
                if (onLocationChanged != null)
                {
                    onLocationChanged.Invoke(currentLocation);
                }
                break;

            default:
                break;
            }
        }
예제 #2
0
 public void UpdateLocation(Vector3 location)
 {
     currentLocation = Coordinates.convertVectorToCoordinates(location);
     if (onLocationChanged != null)
     {
         onLocationChanged.Invoke(currentLocation);
     }
 }
//		public void OnGUI () {
//
//			GUIStyle guiStyle = new GUIStyle();
//			guiStyle.fontSize = 30;
//			GUILayout.Label(currentSpeed + " "+currentMotionState.ToString(), guiStyle);
//
//		}

        #endregion


        #region GPS MOTION TEST

        void changeLocationWASD()
        {
            if (!useWsadInEditor)
            {
                return;
            }

            switch (simulateMotion)
            {
            case MotionPreset.Car:
                demo_WASDspeed = 4;
                break;

            case MotionPreset.Bike:
                demo_WASDspeed = 2;
                break;

            case MotionPreset.Run:
                demo_WASDspeed = 0.8f;
                break;

            default:
                break;
            }


            Vector3 current = currentLocation.convertCoordinateToVector();
            Vector3 v       = current;

            if (Input.GetKey(KeyCode.W))
            {
                v = current + new Vector3(0, 0, demo_WASDspeed);
            }
            if (Input.GetKey(KeyCode.S))
            {
                v = current + new Vector3(0, 0, -demo_WASDspeed);
            }
            if (Input.GetKey(KeyCode.A))
            {
                v = current + new Vector3(-demo_WASDspeed, 0, 0);
            }
            if (Input.GetKey(KeyCode.D))
            {
                v = current + new Vector3(demo_WASDspeed, 0, 0);
            }

            if (!v.Equals(current))
            {
                currentLocation = Coordinates.convertVectorToCoordinates(v);
                if (onLocationChanged != null)
                {
                    onLocationChanged.Invoke(currentLocation);
                }
            }
            CheckMotionState(currentLocation);
        }
예제 #4
0
        public void AddLocation(Vector3 deltaLocation)
        {
            Vector3 current = currentLocation.convertCoordinateToVector();

            currentLocation = Coordinates.convertVectorToCoordinates(current + deltaLocation);
            if (onLocationChanged != null)
            {
                onLocationChanged.Invoke(currentLocation);
            }
        }
 void AvatarPositionCheck()
 {
     if (avatar != null && worldOrigin != null && !worldOrigin.isZeroCoordinates())
     {
         currentLocation = Coordinates.convertVectorToCoordinates(avatar.transform.position);
         if (onLocationChanged != null)
         {
             onLocationChanged.Invoke(currentLocation);
         }
     }
 }
 void AvatarPositionCheck()
 {
     if (demo_CenterWorldCoordinates != null)
     {
         currentLocation = Coordinates.convertVectorToCoordinates(avatar.transform.position);
         if (onLocationChanged != null)
         {
             onLocationChanged.Invoke(currentLocation);
         }
     }
 }