Example #1
0
 /// <summary>
 /// Called every transform update
 /// </summary>
 /// <param name="data"></param>
 public void OnStylusTransformDataRawUpdate(StylusTransformData data)
 {
     if (UseStylusMoveInterface)
     {
         DrawManager.CurrentPosition = data.Position;
     }
 }
Example #2
0
        public void OnStylusTransformDataRawUpdate(StylusTransformData data)
        {
            if (DrawManager == null)
            {
                return;
            }

            DrawManager.CurrentPosition = data.Position;
        }
 /// <summary>
 /// Updates the position of the stylus
 /// </summary>
 /// <param name="data"></param>
 public void OnStylusTransformDataRawUpdate(StylusTransformData data)
 {
     transform.position = data.Position;
     transform.rotation = data.Rotation;
 }
        // Gamepad emulation is handled here.
        void Update()

        {
            if (InputInstance == null)
            {
                return;
            }

            #region Click button input
            float button0 = Input.GetKeyDown("joystick button 0") ? 1 : 0;
            float button1 = Input.GetKeyDown("joystick button 1") ? 1 : 0;
            #endregion


            #region Click button handlers
            _currentButton1.Pressure = button1;
            _currentButton0.Pressure = button0;

            InputInstance.StylusActionButtonData = _currentButton0;
            InputInstance.StylusBackButtonData   = _currentButton1;
            #endregion

            #region Transform data input
            float horizontal = Input.GetAxis("Left Stick X");
            float vertical   = Input.GetAxis("Left Stick Y");
            float lateral    = Input.GetAxis("Right Stick Y");

            bool rotationActive = false;
            //if (Input.GetButton("Rotation lock"))
            //{
            //    rotationActive = true;
            //}
            #endregion

            #region Transform update handlers
            if (!rotationActive)
            {
                transform.position += new Vector3(horizontal, vertical, lateral) * Time.deltaTime * _moveSpeed;
            }
            else
            {
                transform.Rotate(Vector3.up, -horizontal * Time.deltaTime * _rotationSpeed, Space.World);
                transform.Rotate(Vector3.right, vertical * Time.deltaTime * _rotationSpeed, Space.World);
                transform.Rotate(Vector3.forward, -lateral * Time.deltaTime * _rotationSpeed, Space.World);
            }

            if (_lastRotation != transform.rotation || _lastPosition != transform.position)
            {
                var data = new StylusTransformData
                {
                    Position = transform.position,
                    Rotation = transform.rotation
                };

                InputInstance.StylusTransformRaw = data;
            }

            _lastPosition = transform.position;
            _lastRotation = transform.rotation;
            #endregion
        }
Example #5
0
 /// <summary>
 /// Registered method for stylus position update.
 /// </summary>
 /// <param name="data">stylus transform data</param>
 public void OnStylusTransformDataRawUpdate(StylusTransformData data)
 {
     DrawManager.CurrentPosition = data.Position;
 }