Example #1
0
 private void FixHeadAttachedFlashlightPos()
 {
     if (FocusStateEvents.currentState == eFocusState.FPS && !ItemEquippableEvents.CurrentItemHasFlashlight())
     {
         Transform flashlight = m_fpsCamera.m_owner.Inventory.m_flashlight.transform;
         flashlight.position = HMD.Hmd.transform.TransformPoint(m_fpsCamera.m_owner.Inventory.m_flashlightCameraOffset + new Vector3(0, 0, -.1f));
     }
 }
Example #2
0
 public static Vector3 GetVRInteractionLookDir()
 {
     if (ItemEquippableEvents.CurrentItemHasFlashlight())
     {
         return(Controllers.GetAimForward());
     }
     else
     {
         return(hmd.transform.forward);
     }
 }
Example #3
0
        /// <summary>
        /// Returns the camera's position or the controller's or weapons' if the player is
        /// holding a weapon that has a flashlight (and by an extension a lasersight)
        /// </summary>
        /// <returns></returns>

        public static Vector3 GetVRInteractionFromPosition()
        {
            if (ItemEquippableEvents.CurrentItemHasFlashlight())
            {
                return(Controllers.GetAimFromPos());
            }
            else
            {
                return(Hmd.transform.position);
            }
        }
Example #4
0
        public static float VRDetectionMod(Vector3 dir, float distance, float m_flashLightRange, float m_flashlight_spotAngle)
        {
            if (distance > m_flashLightRange)
            {
                return(0.0f);
            }
            Vector3 VRLookDir = fpscamera.Forward;

            if (ItemEquippableEvents.CurrentItemHasFlashlight() && VRSettings.UseVRControllers)
            {
                VRLookDir = Controllers.GetAimForward();
            }
            float angleDiff          = Vector3.Angle(dir, -VRLookDir);
            float spotlightAngleSize = m_flashlight_spotAngle * 0.5f;

            if (angleDiff > spotlightAngleSize)
            {
                return(0.0f);
            }
            float distanceMultiplier = 1.0f - distance / m_flashLightRange;

            return(Mathf.Min((1.0f - angleDiff / spotlightAngleSize) * distanceMultiplier, 0.2f));
        }