예제 #1
0
        public virtual void Play(Vector3 contactPos, Vector3 targetPos, Vector3 targetForward, float targetHeight)
        {
            Vector3 targetDir = contactPos - targetPos;
            var     angle     = BhapticsUtils.Angle(targetDir, targetForward);
            var     offsetY   = (contactPos.y - targetPos.y) / targetHeight;

            Play(1f, 1f, angle, offsetY);
        }
예제 #2
0
        public override void Play(Vector3 contactPos, Vector3 targetPos, Vector3 targetForward, float targetHeight, string identifier = "")
        {
            Vector3 targetDir = contactPos - targetPos;
            var     angle     = BhapticsUtils.Angle(targetDir, targetForward);
            var     offsetY   = (contactPos.y - targetPos.y) / targetHeight;

            Play(this.Intensity, this.Duration, angle, offsetY, identifier);
        }
예제 #3
0
        /// <summary>
        /// Play the haptic feedback with optional values.
        /// </summary>
        /// <param name="intensity">Intensity value of haptic feedback.(Overwrite, not multiplication)</param>
        /// <param name="duration">Duration value of haptic feedback.(Overwrite, not multiplication)</param>
        /// <param name="contactPos"></param>
        /// <param name="targetPos"></param>
        /// <param name="targetForward"></param>
        /// <param name="targetHeight"></param>
        /// <param name="identifier">Use when playing haptic feedback independently.</param>
        public virtual void Play(float intensity, float duration, Vector3 contactPos, Vector3 targetPos, Vector3 targetForward, float targetHeight, string identifier = "")
        {
            Vector3 targetDir = contactPos - targetPos;

            var angle = BhapticsUtils.Angle(targetDir, targetForward);

            var offsetY = (contactPos.y - targetPos.y) / targetHeight;

            Play(intensity, duration, angle, offsetY, identifier);
        }
예제 #4
0
        private void Play(PositionTag posTag, Vector3 contactPos, Vector3 targetPos, Vector3 targetForward, float targetHeight)
        {
            var angle   = 0f;
            var offsetY = 0f;

            if (posTag == PositionTag.Body)
            {
                Vector3 targetDir = contactPos - targetPos;
                angle   = BhapticsUtils.Angle(targetDir, targetForward);
                offsetY = (contactPos.y - targetPos.y) / targetHeight;
            }

            Play(posTag, angle, offsetY);
        }