Пример #1
0
        private void SetVelocity()
        {
            var controllerIndex = VRTK_DeviceFinder.GetControllerIndex(gameObject);

            controllerVelocity        = VRTK_SDK_Bridge.GetVelocityOnIndex(controllerIndex);
            controllerAngularVelocity = VRTK_SDK_Bridge.GetAngularVelocityOnIndex(controllerIndex);
        }
Пример #2
0
        private void SetVelocity()
        {
            var origin          = VRTK_DeviceFinder.TrackedObjectOrigin(gameObject);
            var velocity        = VRTK_SDK_Bridge.GetVelocityOnIndex(controllerIndex);
            var angularVelocity = VRTK_SDK_Bridge.GetAngularVelocityOnIndex(controllerIndex);

            if (origin != null)
            {
                controllerVelocity        = origin.TransformDirection(velocity);
                controllerAngularVelocity = origin.TransformDirection(angularVelocity);
            }
            else
            {
                controllerVelocity        = velocity;
                controllerAngularVelocity = angularVelocity;
            }
        }
Пример #3
0
        /// <summary>
        /// The GetControllerVelocity method is used for getting the current velocity of the physical game controller. This can be useful to determine the speed at which the controller is being swung or the direction it is being moved in.
        /// </summary>
        /// <param name="givenController">The GameObject of the controller.</param>
        /// <returns>A 3 dimensional vector containing the current real world physical controller velocity.</returns>
        public static Vector3 GetControllerVelocity(GameObject givenController)
        {
            var controllerIndex = GetControllerIndex(givenController);

            return(VRTK_SDK_Bridge.GetVelocityOnIndex(controllerIndex));
        }
 private void SetVelocity()
 {
     controllerVelocity        = VRTK_SDK_Bridge.GetVelocityOnIndex(controllerIndex);;
     controllerAngularVelocity = VRTK_SDK_Bridge.GetAngularVelocityOnIndex(controllerIndex);;
 }