Example #1
0
        protected virtual void Awake()
        {
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            originalPointerOriginTransform = pointerOriginTransform;

            VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this);
        }
Example #2
0
        private void CreateCollider()
        {
            generateCollider  = false;
            generateRigidbody = false;

            VRTK_PlayerObject.SetPlayerObject(playArea.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);
            bodyRigidbody = playArea.GetComponent <Rigidbody>();
            if (bodyRigidbody == null)
            {
                generateRigidbody            = true;
                bodyRigidbody                = playArea.gameObject.AddComponent <Rigidbody>();
                bodyRigidbody.mass           = 100f;
                bodyRigidbody.freezeRotation = true;
            }

            bodyCollider = playArea.GetComponent <CapsuleCollider>();
            if (bodyCollider == null)
            {
                generateCollider    = true;
                bodyCollider        = playArea.gameObject.AddComponent <CapsuleCollider>();
                bodyCollider.center = new Vector3(0f, 1f, 0f);
                bodyCollider.height = 1f;
                bodyCollider.radius = 0.15f;
            }

            if (playArea.gameObject.layer == 0)
            {
                playArea.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
            }
            TogglePhysics(enableBodyCollisions);
        }
Example #3
0
        protected virtual void CreateObjectInteractor()
        {
            objectInteractor = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "BasePointerRenderer_ObjectInteractor_Container"));
            objectInteractor.transform.SetParent(controllingPointer.controllerEvents.transform);
            objectInteractor.transform.localPosition = Vector3.zero;
            objectInteractor.layer = LayerMask.NameToLayer("Ignore Raycast");
            VRTK_PlayerObject.SetPlayerObject(objectInteractor, VRTK_PlayerObject.ObjectTypes.Pointer);

            GameObject objectInteractorCollider = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "BasePointerRenderer_ObjectInteractor_Collider"));

            objectInteractorCollider.transform.SetParent(objectInteractor.transform);
            objectInteractorCollider.transform.localPosition = Vector3.zero;
            objectInteractorCollider.layer = LayerMask.NameToLayer("Ignore Raycast");
            SphereCollider tmpCollider = objectInteractorCollider.AddComponent <SphereCollider>();

            tmpCollider.isTrigger = true;
            VRTK_PlayerObject.SetPlayerObject(objectInteractorCollider, VRTK_PlayerObject.ObjectTypes.Pointer);

            if (controllingPointer.grabToPointerTip)
            {
                objectInteractorAttachPoint = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "BasePointerRenderer_ObjectInteractor_AttachPoint"));
                objectInteractorAttachPoint.transform.SetParent(objectInteractor.transform);
                objectInteractorAttachPoint.transform.localPosition = Vector3.zero;
                objectInteractorAttachPoint.layer = LayerMask.NameToLayer("Ignore Raycast");
                Rigidbody objectInteratorRigidBody = objectInteractorAttachPoint.AddComponent <Rigidbody>();
                objectInteratorRigidBody.isKinematic            = true;
                objectInteratorRigidBody.freezeRotation         = true;
                objectInteratorRigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
                VRTK_PlayerObject.SetPlayerObject(objectInteractorAttachPoint, VRTK_PlayerObject.ObjectTypes.Pointer);
            }

            ScaleObjectInteractor(Vector3.one);
            objectInteractor.SetActive(false);
        }
Example #4
0
        // Token: 0x060018E5 RID: 6373 RVA: 0x00084C14 File Offset: 0x00082E14
        protected virtual void CreateObjectInteractor()
        {
            this.objectInteractor = new GameObject(string.Format("[{0}]BasePointer_ObjectInteractor_Holder", base.gameObject.name));
            this.objectInteractor.transform.SetParent(this.controller.transform);
            this.objectInteractor.transform.localPosition = Vector3.zero;
            this.objectInteractor.layer = LayerMask.NameToLayer("Ignore Raycast");
            VRTK_PlayerObject.SetPlayerObject(this.objectInteractor, VRTK_PlayerObject.ObjectTypes.Pointer);
            GameObject gameObject = new GameObject(string.Format("[{0}]BasePointer_ObjectInteractor_Collider", base.gameObject.name));

            gameObject.transform.SetParent(this.objectInteractor.transform);
            gameObject.transform.localPosition = Vector3.zero;
            gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
            gameObject.AddComponent <SphereCollider>().isTrigger = true;
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            if (this.grabToPointerTip)
            {
                this.objectInteractorAttachPoint = new GameObject(string.Format("[{0}]BasePointer_ObjectInteractor_AttachPoint", base.gameObject.name));
                this.objectInteractorAttachPoint.transform.SetParent(this.objectInteractor.transform);
                this.objectInteractorAttachPoint.transform.localPosition = Vector3.zero;
                this.objectInteractorAttachPoint.layer = LayerMask.NameToLayer("Ignore Raycast");
                Rigidbody rigidbody = this.objectInteractorAttachPoint.AddComponent <Rigidbody>();
                rigidbody.isKinematic            = true;
                rigidbody.freezeRotation         = true;
                rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
                VRTK_PlayerObject.SetPlayerObject(this.objectInteractorAttachPoint, VRTK_PlayerObject.ObjectTypes.Pointer);
            }
            float num = 0.025f;

            this.objectInteractor.transform.localScale = new Vector3(num, num, num);
            this.objectInteractor.SetActive(false);
        }
Example #5
0
        protected override void InitPointer()
        {
            pointerCursor = (customPointerCursor ? Instantiate(customPointerCursor) : CreateCursor());
            if (validTeleportLocationObject != null)
            {
                validTeleportLocationInstance      = Instantiate(validTeleportLocationObject);
                validTeleportLocationInstance.name = string.Format("[{0}]BasePointer_BezierPointer_TeleportBeam", gameObject.name);
                validTeleportLocationInstance.transform.SetParent(pointerCursor.transform);
                validTeleportLocationInstance.layer = LayerMask.NameToLayer("Ignore Raycast");
                validTeleportLocationInstance.SetActive(false);
            }

            pointerCursor.name = string.Format("[{0}]BasePointer_BezierPointer_PointerCursor", gameObject.name);
            VRTK_PlayerObject.SetPlayerObject(pointerCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
            pointerCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
            pointerCursor.SetActive(false);

            curvedBeamContainer = new GameObject(string.Format("[{0}]BasePointer_BezierPointer_CurvedBeamContainer", gameObject.name));
            VRTK_PlayerObject.SetPlayerObject(curvedBeamContainer, VRTK_PlayerObject.ObjectTypes.Pointer);
            curvedBeamContainer.SetActive(false);
            curvedBeam = curvedBeamContainer.gameObject.AddComponent <VRTK_CurveGenerator>();
            curvedBeam.transform.SetParent(null);
            curvedBeam.Create(pointerDensity, pointerCursorRadius, customPointerTracer, rescalePointerTracer);

            base.InitPointer();
        }
Example #6
0
        protected virtual void InitPlayAreaCursor()
        {
            if (playArea == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK"));
                return;
            }

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);
            if (validLocationObject != null)
            {
                GeneratePlayAreaCursorFromPrefab(cursorDrawVertices);
            }
            else
            {
                GeneratePlayAreaCursor(cursorDrawVertices);
            }

            if (playAreaCursor != null)
            {
                playAreaCursor.SetActive(false);
                VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
                CreateCursorCollider(playAreaCursor);
                playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

                VRTK_PlayAreaCollider playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();
                playAreaCursorScript.SetParent(this);
                playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
                playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
            }
        }
Example #7
0
 protected virtual void OnEnable()
 {
     VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller);
     triggerRumble = false;
     CreateTouchCollider();
     CreateTouchRigidBody();
 }
Example #8
0
        protected virtual void InitPlayAreaCursor()
        {
            if (playArea == null)
            {
                Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown.");
                return;
            }

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);
            if (validLocationObject != null)
            {
                GeneratePlayAreaCursorFromPrefab(cursorDrawVertices);
            }
            else
            {
                GeneratePlayAreaCursor(cursorDrawVertices);
            }

            if (playAreaCursor != null)
            {
                playAreaCursor.SetActive(false);
                VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
                CreateCursorCollider(playAreaCursor);
                playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

                VRTK_PlayAreaCollider playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();
                playAreaCursorScript.SetParent(this);
                playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
                playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
            }
        }
        protected virtual void CreateObjectInteractor()
        {
            objectInteractor = new GameObject(string.Format("[{0}]BasePointerRenderer_ObjectInteractor_Container", gameObject.name));
            objectInteractor.transform.SetParent(controllingPointer.controller.transform);
            objectInteractor.transform.localPosition = Vector3.zero;
            objectInteractor.layer = LayerMask.NameToLayer("Ignore Raycast");
            VRTK_PlayerObject.SetPlayerObject(objectInteractor, VRTK_PlayerObject.ObjectTypes.Pointer);

            var objectInteractorCollider = new GameObject(string.Format("[{0}]BasePointerRenderer_ObjectInteractor_Collider", gameObject.name));

            objectInteractorCollider.transform.SetParent(objectInteractor.transform);
            objectInteractorCollider.transform.localPosition = Vector3.zero;
            objectInteractorCollider.layer = LayerMask.NameToLayer("Ignore Raycast");
            var tmpCollider = objectInteractorCollider.AddComponent <SphereCollider>();

            tmpCollider.isTrigger = true;
            VRTK_PlayerObject.SetPlayerObject(objectInteractorCollider, VRTK_PlayerObject.ObjectTypes.Pointer);

            if (controllingPointer.grabToPointerTip)
            {
                objectInteractorAttachPoint = new GameObject(string.Format("[{0}]BasePointerRenderer_ObjectInteractor_AttachPoint", gameObject.name));
                objectInteractorAttachPoint.transform.SetParent(objectInteractor.transform);
                objectInteractorAttachPoint.transform.localPosition = Vector3.zero;
                objectInteractorAttachPoint.layer = LayerMask.NameToLayer("Ignore Raycast");
                var objectInteratorRigidBody = objectInteractorAttachPoint.AddComponent <Rigidbody>();
                objectInteratorRigidBody.isKinematic            = true;
                objectInteratorRigidBody.freezeRotation         = true;
                objectInteratorRigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
                VRTK_PlayerObject.SetPlayerObject(objectInteractorAttachPoint, VRTK_PlayerObject.ObjectTypes.Pointer);
            }

            ScaleObjectInteractor(Vector3.one * 0.025f);
            objectInteractor.SetActive(false);
        }
Example #10
0
 private void Awake()
 {
     controllerEvents  = GetComponent <VRTK_ControllerEvents>();
     controllerActions = GetComponent <VRTK_ControllerActions>();
     VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller);
     destroyColliderOnDisable = false;
     defaultColliderPrefab    = Resources.Load(VRTK_SDK_Bridge.GetControllerDefaultColliderPath());
 }
Example #11
0
 // Token: 0x0600192E RID: 6446 RVA: 0x000861EE File Offset: 0x000843EE
 protected virtual void OnEnable()
 {
     VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
     this.headset  = VRTK_DeviceFinder.HeadsetTransform();
     this.playArea = VRTK_DeviceFinder.PlayAreaTransform();
     this.playAreaCursorBoundaries = new GameObject[4];
     this.InitPlayAreaCursor();
 }
Example #12
0
        private void InitPlayAreaCursor()
        {
            var btmRightInner = 0;
            var btmLeftInner  = 1;
            var topLeftInner  = 2;
            var topRightInner = 3;

            var btmRightOuter = 4;
            var btmLeftOuter  = 5;
            var topLeftOuter  = 6;
            var topRightOuter = 7;

            Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);

            if (playAreaCursorDimensions != Vector2.zero)
            {
                var customAreaPadding = VRTK_SDK_Bridge.GetPlayAreaBorderThickness(playArea.gameObject);

                cursorDrawVertices[btmRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[btmLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, (playAreaCursorDimensions.y / 2) * -1);
                cursorDrawVertices[topLeftOuter]  = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, playAreaCursorDimensions.y / 2);
                cursorDrawVertices[topRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, playAreaCursorDimensions.y / 2);

                cursorDrawVertices[btmRightInner] = cursorDrawVertices[btmRightOuter] + new Vector3(-customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[btmLeftInner]  = cursorDrawVertices[btmLeftOuter] + new Vector3(customAreaPadding, 0f, customAreaPadding);
                cursorDrawVertices[topLeftInner]  = cursorDrawVertices[topLeftOuter] + new Vector3(customAreaPadding, 0f, -customAreaPadding);
                cursorDrawVertices[topRightInner] = cursorDrawVertices[topRightOuter] + new Vector3(-customAreaPadding, 0f, -customAreaPadding);
            }

            var width  = cursorDrawVertices[btmRightOuter].x - cursorDrawVertices[topLeftOuter].x;
            var length = cursorDrawVertices[topLeftOuter].z - cursorDrawVertices[btmRightOuter].z;
            var height = 0.01f;

            playAreaCursor = new GameObject(string.Format("[{0}]PlayAreaCursor", gameObject.name));
            playAreaCursor.transform.parent     = null;
            playAreaCursor.transform.localScale = new Vector3(width, height, length);
            playAreaCursor.SetActive(false);

            CreateCursorCollider(playAreaCursor);
            playAreaCursor.AddComponent <Rigidbody>().isKinematic = true;

            VRTK_PlayerObject.SetPlayerObject(playAreaCursor, VRTK_PlayerObject.ObjectTypes.Pointer);

            var playAreaCursorScript = playAreaCursor.AddComponent <VRTK_PlayAreaCollider>();

            playAreaCursorScript.SetParent(this);
            playAreaCursorScript.SetIgnoreTarget(targetListPolicy);
            playAreaCursor.layer = LayerMask.NameToLayer("Ignore Raycast");

            var playAreaBoundaryX = playArea.transform.localScale.x / 2;
            var playAreaBoundaryZ = playArea.transform.localScale.z / 2;
            var heightOffset      = 0f;

            DrawPlayAreaCursorBoundary(0, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(1, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(playAreaBoundaryX, heightOffset, 0f));
            DrawPlayAreaCursorBoundary(2, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmRightOuter].x, cursorDrawVertices[btmRightInner].z, cursorDrawVertices[btmRightOuter].z, height, new Vector3(0f, heightOffset, -playAreaBoundaryZ));
            DrawPlayAreaCursorBoundary(3, cursorDrawVertices[btmLeftOuter].x, cursorDrawVertices[btmLeftInner].x, cursorDrawVertices[topLeftOuter].z, cursorDrawVertices[btmLeftOuter].z, height, new Vector3(-playAreaBoundaryX, heightOffset, 0f));
        }
 protected virtual void CreateCursor()
 {
     actualCursor = (customCursor ? Instantiate(customCursor) : CreateCursorObject());
     CreateCursorLocations();
     actualCursor.name = string.Format("[{0}]BezierPointerRenderer_Cursor", gameObject.name);
     VRTK_PlayerObject.SetPlayerObject(actualCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
     actualCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
     actualCursor.SetActive(false);
 }
        protected virtual void Awake()
        {
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);
            headset  = VRTK_SharedMethods.AddCameraFade();
            playArea = VRTK_DeviceFinder.PlayAreaTransform();

            // initialize world rotater
            worldRotater = UnityEngine.GameObject.FindGameObjectWithTag("rotater").GetComponent <WorldRotater>();
        }
Example #15
0
 protected virtual void CreateCursor()
 {
     actualCursor = (customCursor ? Instantiate(customCursor) : CreateCursorObject());
     CreateCursorLocations();
     actualCursor.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "BezierPointerRenderer_Cursor");
     VRTK_PlayerObject.SetPlayerObject(actualCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
     actualCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
     actualCursor.SetActive(false);
 }
Example #16
0
        protected override void InitPointer()
        {
            pointerHolder = new GameObject(string.Format("[{0}]BasePointer_SimplePointer_Holder", gameObject.name));
            pointerHolder.transform.localPosition = Vector3.zero;
            VRTK_PlayerObject.SetPlayerObject(pointerHolder, VRTK_PlayerObject.ObjectTypes.Pointer);

            pointerBeam = GameObject.CreatePrimitive(PrimitiveType.Cube);
            pointerBeam.transform.name = string.Format("[{0}]BasePointer_SimplePointer_Pointer", gameObject.name);
            pointerBeam.transform.SetParent(pointerHolder.transform);
            pointerBeam.GetComponent <BoxCollider>().isTrigger = true;
            pointerBeam.AddComponent <Rigidbody>().isKinematic = true;
            pointerBeam.layer = LayerMask.NameToLayer("Ignore Raycast");

            var pointerRenderer = pointerBeam.GetComponent <MeshRenderer>();

            pointerRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            pointerRenderer.receiveShadows    = false;
            pointerRenderer.material          = pointerMaterial;

            VRTK_PlayerObject.SetPlayerObject(pointerBeam, VRTK_PlayerObject.ObjectTypes.Pointer);

            if (customPointerCursor)
            {
                pointerTip = Instantiate(customPointerCursor);
            }
            else
            {
                pointerTip = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                pointerTip.transform.localScale = pointerTipScale;

                var pointerTipRenderer = pointerTip.GetComponent <MeshRenderer>();
                pointerTipRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
                pointerTipRenderer.receiveShadows    = false;
                pointerTipRenderer.material          = pointerMaterial;
            }

            pointerCursorOriginalScale = pointerTip.transform.localScale;
            pointerTip.transform.name  = string.Format("[{0}]BasePointer_SimplePointer_PointerTip", gameObject.name);
            pointerTip.transform.SetParent(pointerHolder.transform);
            pointerTip.GetComponent <Collider>().isTrigger    = true;
            pointerTip.AddComponent <Rigidbody>().isKinematic = true;
            pointerTip.layer = LayerMask.NameToLayer("Ignore Raycast");


            VRTK_PlayerObject.SetPlayerObject(pointerTip, VRTK_PlayerObject.ObjectTypes.Pointer);

            base.InitPointer();

            if (showPointerTip && objectInteractor)
            {
                objectInteractor.transform.localScale = pointerTip.transform.localScale * 1.05f;
            }

            SetPointerTransform(pointerLength, pointerThickness);
            TogglePointer(false);
        }
Example #17
0
 protected virtual void OnEnable()
 {
     headset = VRTK_DeviceFinder.HeadsetTransform();
     if (headset != null)
     {
         headsetColliding = false;
         SetupHeadset();
         VRTK_PlayerObject.SetPlayerObject(headsetColliderContainer.gameObject, VRTK_PlayerObject.ObjectTypes.Headset);
     }
 }
Example #18
0
 // Token: 0x0600179F RID: 6047 RVA: 0x0007E610 File Offset: 0x0007C810
 protected virtual void OnEnable()
 {
     VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);
     this.headset            = VRTK_SharedMethods.AddCameraFade();
     this.playArea           = VRTK_DeviceFinder.PlayAreaTransform();
     this.adjustYForTerrain  = false;
     this.enableTeleport     = true;
     this.initaliseListeners = base.StartCoroutine(this.InitListenersAtEndOfFrame());
     VRTK_ObjectCache.registeredTeleporters.Add(this);
 }
Example #19
0
 // Token: 0x060015EA RID: 5610 RVA: 0x000779C8 File Offset: 0x00075BC8
 protected virtual void OnEnable()
 {
     this.destroyColliderOnDisable = false;
     SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(base.gameObject);
     this.defaultColliderPrefab = Resources.Load(VRTK_SDK_Bridge.GetControllerDefaultColliderPath(controllerHand));
     VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.Controller);
     this.triggerRumble = false;
     this.CreateTouchCollider();
     this.CreateTouchRigidBody();
 }
Example #20
0
        protected virtual void OnEnable()
        {
            controllerEvents  = GetComponent <VRTK_ControllerEvents>();
            controllerActions = GetComponent <VRTK_ControllerActions>();

            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller);
            triggerRumble = false;
            CreateTouchCollider();
            CreateTouchRigidBody();
        }
Example #21
0
        protected virtual void Awake()
        {
            controllerEvents  = GetComponent <VRTK_ControllerEvents>();
            controllerActions = GetComponent <VRTK_ControllerActions>();
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller);
            destroyColliderOnDisable = false;
            var controllerHand = VRTK_DeviceFinder.GetControllerHand(gameObject);

            defaultColliderPrefab = Resources.Load(VRTK_SDK_Bridge.GetControllerDefaultColliderPath(controllerHand));
        }
Example #22
0
 protected virtual void OnEnable()
 {
     destroyColliderOnDisable = false;
     VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller);
     CreateTouchRigidBody();
     trackedController = GetComponentInParent <VRTK_TrackedController>();
     if (trackedController != null)
     {
         trackedController.ControllerModelAvailable += DoControllerModelAvailable;
     }
 }
Example #23
0
 // Token: 0x06001A1C RID: 6684 RVA: 0x0008AC37 File Offset: 0x00088E37
 protected virtual void OnEnable()
 {
     VRTK_ObjectCache.registeredHeadsetCollider = this;
     this.headset = VRTK_DeviceFinder.HeadsetTransform();
     if (this.headset != null)
     {
         this.headsetColliding = false;
         this.SetupHeadset();
         VRTK_PlayerObject.SetPlayerObject(this.GetHeadsetColliderContainer(), VRTK_PlayerObject.ObjectTypes.Headset);
     }
 }
Example #24
0
        protected override void OnEnable()
        {
            base.OnEnable();
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            SetDefaultValues();

            if (NoPointerRenderer())
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_PARAMETER, "VRTK_Pointer", "VRTK_BasePointerRenderer", "Pointer Renderer"));
            }
        }
Example #25
0
 protected virtual void OnEnable()
 {
     VRTK_ObjectCache.registeredHeadsetCollider = this;
     headset = VRTK_DeviceFinder.HeadsetTransform();
     if (headset)
     {
         headsetColliding = false;
         SetupHeadset();
         VRTK_PlayerObject.SetPlayerObject(headsetColliderContainer.gameObject, VRTK_PlayerObject.ObjectTypes.Headset);
     }
 }
Example #26
0
        protected virtual void Start()
        {
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);
            SetControllerListeners(controllerLeftHand);
            SetControllerListeners(controllerRightHand);

            bodyCollider = playArea.GetComponent <CapsuleCollider>();
            if (!bodyCollider)
            {
                Debug.LogError("No body collider could be found in the play area. VRTK_BodyPhysics script is required in one of the scene GameObjects.");
            }
        }
Example #27
0
        protected override void OnEnable()
        {
#pragma warning disable 0618
            controllerEvents = (controller != null && controllerEvents == null ? controller : controllerEvents);
#pragma warning restore 0618
            base.OnEnable();
            attachedTo = (attachedTo == null ? gameObject : attachedTo);
            if (!VRTK_PlayerObject.IsPlayerObject(gameObject))
            {
                VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            }
            SetDefaultValues();
        }
Example #28
0
 // Token: 0x060018B1 RID: 6321 RVA: 0x0008353C File Offset: 0x0008173C
 protected virtual void CreateCursor()
 {
     this.actualCursor = (this.customCursor ? Object.Instantiate <GameObject>(this.customCursor) : this.CreateCursorObject());
     this.CreateCursorLocations();
     this.actualCursor.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, new object[]
     {
         base.gameObject.name,
         "BezierPointerRenderer_Cursor"
     });
     VRTK_PlayerObject.SetPlayerObject(this.actualCursor, VRTK_PlayerObject.ObjectTypes.Pointer);
     this.actualCursor.layer = LayerMask.NameToLayer("Ignore Raycast");
     this.actualCursor.SetActive(false);
 }
        protected virtual void Awake()
        {
            touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged);
            touchpadUntouched   = new ControllerInteractionEventHandler(DoTouchpadTouchEnd);
            playArea            = VRTK_DeviceFinder.PlayAreaTransform();
            controllerLeftHand  = VRTK_DeviceFinder.GetControllerLeftHand();
            controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand();
            if (!playArea)
            {
                Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown.");
            }

            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);
        }
Example #30
0
        protected virtual GameObject CreateColliderContainer(string name, Transform parent)
        {
            GameObject generatedContainer = new GameObject(name);

            generatedContainer.transform.SetParent(parent);
            generatedContainer.transform.localPosition = Vector3.zero;
            generatedContainer.transform.localRotation = Quaternion.identity;
            generatedContainer.transform.localScale    = Vector3.one;

            generatedContainer.layer = LayerMask.NameToLayer("Ignore Raycast");
            VRTK_PlayerObject.SetPlayerObject(generatedContainer, VRTK_PlayerObject.ObjectTypes.Collider);

            return(generatedContainer);
        }