protected virtual void CreatePointerOriginTransformFollow()
 {
     pointerOriginTransformFollowGameObject    = new GameObject(string.Format("[{0}]BasePointerRenderer_Origin_Smoothed", gameObject.name));
     pointerOriginTransformFollow              = pointerOriginTransformFollowGameObject.AddComponent <VRTK_TransformFollow>();
     pointerOriginTransformFollow.enabled      = false;
     pointerOriginTransformFollow.followsScale = false;
 }
 protected virtual void CreatePointerOriginTransformFollow()
 {
     pointerOriginTransformFollowGameObject    = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "BasePointerRenderer_Origin_Smoothed"));
     pointerOriginTransformFollow              = pointerOriginTransformFollowGameObject.AddComponent <VRTK_TransformFollow>();
     pointerOriginTransformFollow.enabled      = false;
     pointerOriginTransformFollow.followsScale = false;
 }
Example #3
0
        protected virtual void OnEnable()
        {
            desktopCamera = desktopCamera == null?GetComponentInChildren <Camera>() : desktopCamera;

            followScript = followScript == null?GetComponentInChildren <VRTK_ObjectFollow>() : followScript;

            if (desktopCamera == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "VRTK_DesktopCamera", "Camera", "desktopCamera", "the same", " or any child of it"));
                return;
            }

            if (followScript == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "VRTK_DesktopCamera", "VRTK_ObjectFollow", "followScript", "the same", " or any child of it"));
                return;
            }

            headsetCameraTransformFollow        = gameObject.AddComponent <VRTK_TransformFollow>();
            headsetCameraTransformFollow.moment = VRTK_TransformFollow.FollowMoment.OnLateUpdate;

            if (VRTK_SDKManager.SubscribeLoadedSetupChanged(LoadedSetupChanged) && VRTK_SDKManager.GetLoadedSDKSetup() != null)
            {
                ConfigureForCurrentSDKSetup();
            }
        }
Example #4
0
 protected virtual void DestroyPointerOriginTransformFollow()
 {
     if (pointerOriginTransformFollowGameObject != null)
     {
         Destroy(pointerOriginTransformFollowGameObject);
         pointerOriginTransformFollowGameObject = null;
         pointerOriginTransformFollow           = null;
     }
 }
Example #5
0
 protected virtual void CreatePointerOriginTransformFollow()
 {
     pointerOriginTransformFollowGameObject = new GameObject(string.Format("[{0}]BasePointer_Origin_Smoothed", gameObject.name));
     pointerOriginTransformFollowGameObject.SetActive(false);
     pointerOriginTransformFollow = pointerOriginTransformFollowGameObject.AddComponent <VRTK_TransformFollow>();
     pointerOriginTransformFollow.gameObjectToChange = pointerOriginTransformFollowGameObject;
     pointerOriginTransformFollow.followsScale       = false;
     UpdatePointerOriginTransformFollow();
 }