コード例 #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
ファイル: VRTK_DeviceFinder.cs プロジェクト: zeya-anwar/VRTK
        /// <summary>
        /// The GetControllerAngularVelocity method is used for getting the current rotational velocity of the physical game controller. This can be useful for determining which way the controller is being rotated and at what speed the rotation is occurring.
        /// </summary>
        /// <param name="givenController">The GameObject of the controller.</param>
        /// <returns>A 3 dimensional vector containing the current real world physical controller angular (rotational) velocity.</returns>
        public static Vector3 GetControllerAngularVelocity(GameObject givenController)
        {
            var controllerIndex = GetControllerIndex(givenController);

            return(VRTK_SDK_Bridge.GetAngularVelocityOnIndex(controllerIndex));
        }
コード例 #4
0
 private void SetVelocity()
 {
     controllerVelocity        = VRTK_SDK_Bridge.GetVelocityOnIndex(controllerIndex);;
     controllerAngularVelocity = VRTK_SDK_Bridge.GetAngularVelocityOnIndex(controllerIndex);;
 }