protected virtual void CreateCollider() { generateCollider = false; generateRigidbody = false; if (playArea == null) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); return; } 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 = bodyMass; bodyRigidbody.freezeRotation = true; } if (bodyColliderContainer == null) { generateCollider = true; bodyColliderContainer = CreateColliderContainer(BODY_COLLIDER_CONTAINER_NAME, playArea); bodyCollider = bodyColliderContainer.AddComponent <CapsuleCollider>(); bodyCollider.radius = bodyRadius; if (CalculateStepUpYOffset() > 0f) { GameObject footColliderContainer = CreateColliderContainer(FOOT_COLLIDER_CONTAINER_NAME, bodyColliderContainer.transform); footCollider = footColliderContainer.AddComponent <CapsuleCollider>(); } bodyColliderContainer.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); VRTK_PlayerObject.SetPlayerObject(bodyColliderContainer, VRTK_PlayerObject.ObjectTypes.Collider); } if (playArea.gameObject.layer == 0) { playArea.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); } TogglePhysics(enableBodyCollisions); }
protected override void CreatePointerObjects() { actualContainer = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "StraightPointerRenderer_Container")); actualContainer.transform.SetParent(pointerOriginTransformFollowGameObject.transform); actualContainer.transform.localPosition = Vector3.zero; actualContainer.transform.localRotation = Quaternion.identity; actualContainer.transform.localScale = Vector3.one; VRTK_PlayerObject.SetPlayerObject(actualContainer, VRTK_PlayerObject.ObjectTypes.Pointer); CreateTracer(); CreateCursor(); Toggle(false, false); if (controllingPointer != null) { controllingPointer.ResetActivationTimer(true); controllingPointer.ResetSelectionTimer(true); } }
// Token: 0x060018AA RID: 6314 RVA: 0x000831EC File Offset: 0x000813EC protected override void CreatePointerObjects() { this.actualContainer = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, new object[] { base.gameObject.name, "BezierPointerRenderer_Container" })); VRTK_PlayerObject.SetPlayerObject(this.actualContainer, VRTK_PlayerObject.ObjectTypes.Pointer); this.actualContainer.SetActive(false); this.CreateTracer(); this.CreateCursor(); this.Toggle(false, false); if (this.controllingPointer) { this.controllingPointer.ResetActivationTimer(true); this.controllingPointer.ResetSelectionTimer(true); } }
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(); if (NoPointerRenderer()) { VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_PARAMETER, "VRTK_Pointer", "VRTK_BasePointerRenderer", "Pointer Renderer")); } }
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(); if (validLocationObject != null) { GeneratePlayAreaCursorFromPrefab(cursorDrawVertices); } else { if (cursorDrawVertices == null || cursorDrawVertices.Length < 8) { cursorDrawVertices = new Vector3[] { new Vector3(0.8f, 0f, -0.8f), new Vector3(-0.8f, 0f, -0.8f), new Vector3(-0.8f, 0f, 0.8f), new Vector3(0.8f, 0f, 0.8f), new Vector3(1f, 0f, -1f), new Vector3(-1f, 0f, -1f), new Vector3(-1f, 0f, 1f), new Vector3(1f, 0f, 1f) }; } 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"); } }
// Token: 0x0600198F RID: 6543 RVA: 0x0008815C File Offset: 0x0008635C protected override void InitPointer() { this.pointerHolder = new GameObject(string.Format("[{0}]BasePointer_SimplePointer_Holder", base.gameObject.name)); this.pointerHolder.transform.localPosition = Vector3.zero; VRTK_PlayerObject.SetPlayerObject(this.pointerHolder, VRTK_PlayerObject.ObjectTypes.Pointer); this.pointerBeam = GameObject.CreatePrimitive(PrimitiveType.Cube); this.pointerBeam.transform.name = string.Format("[{0}]BasePointer_SimplePointer_Pointer", base.gameObject.name); this.pointerBeam.transform.SetParent(this.pointerHolder.transform); this.pointerBeam.GetComponent <BoxCollider>().isTrigger = true; this.pointerBeam.AddComponent <Rigidbody>().isKinematic = true; this.pointerBeam.layer = LayerMask.NameToLayer("Ignore Raycast"); MeshRenderer component = this.pointerBeam.GetComponent <MeshRenderer>(); component.shadowCastingMode = ShadowCastingMode.Off; component.receiveShadows = false; component.material = this.pointerMaterial; VRTK_PlayerObject.SetPlayerObject(this.pointerBeam, VRTK_PlayerObject.ObjectTypes.Pointer); if (this.customPointerCursor) { this.pointerTip = Object.Instantiate <GameObject>(this.customPointerCursor); } else { this.pointerTip = GameObject.CreatePrimitive(PrimitiveType.Sphere); this.pointerTip.transform.localScale = this.pointerTipScale; MeshRenderer component2 = this.pointerTip.GetComponent <MeshRenderer>(); component2.shadowCastingMode = ShadowCastingMode.Off; component2.receiveShadows = false; component2.material = this.pointerMaterial; } this.pointerCursorOriginalScale = this.pointerTip.transform.localScale; this.pointerTip.transform.name = string.Format("[{0}]BasePointer_SimplePointer_PointerTip", base.gameObject.name); this.pointerTip.transform.SetParent(this.pointerHolder.transform); this.pointerTip.GetComponent <Collider>().isTrigger = true; this.pointerTip.AddComponent <Rigidbody>().isKinematic = true; this.pointerTip.layer = LayerMask.NameToLayer("Ignore Raycast"); VRTK_PlayerObject.SetPlayerObject(this.pointerTip, VRTK_PlayerObject.ObjectTypes.Pointer); base.InitPointer(); this.ResizeObjectInteractor(); this.SetPointerTransform(this.pointerLength, this.pointerThickness); this.TogglePointer(false); }
private void DrawPlayAreaCursorBoundary(int index, float left, float right, float top, float bottom, float thickness, Vector3 localPosition) { var playAreaCursorBoundary = GameObject.CreatePrimitive(PrimitiveType.Cube); playAreaCursorBoundary.name = string.Format("[{0}]PlayAreaCursorBoundary_" + index, gameObject.name); VRTK_PlayerObject.SetPlayerObject(playAreaCursorBoundary, VRTK_PlayerObject.ObjectTypes.Pointer); var width = (right - left) / 1.065f; var length = (top - bottom) / 1.08f; var height = thickness; playAreaCursorBoundary.transform.localScale = new Vector3(width, height, length); Destroy(playAreaCursorBoundary.GetComponent <BoxCollider>()); playAreaCursorBoundary.layer = LayerMask.NameToLayer("Ignore Raycast"); playAreaCursorBoundary.transform.parent = playAreaCursor.transform; playAreaCursorBoundary.transform.localPosition = localPosition; playAreaCursorBoundaries[index] = playAreaCursorBoundary; }
protected virtual void DrawPlayAreaCursorBoundary(int index, float left, float right, float top, float bottom, float thickness, Vector3 localPosition) { GameObject playAreaCursorBoundary = GameObject.CreatePrimitive(PrimitiveType.Cube); playAreaCursorBoundary.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "PlayAreaCursorBoundary", index); VRTK_PlayerObject.SetPlayerObject(playAreaCursorBoundary, VRTK_PlayerObject.ObjectTypes.Pointer); float width = (right - left) / 1.065f; float length = (top - bottom) / 1.08f; float height = thickness; playAreaCursorBoundary.transform.localScale = new Vector3(width, height, length); Destroy(playAreaCursorBoundary.GetComponent <BoxCollider>()); playAreaCursorBoundary.layer = LayerMask.NameToLayer("Ignore Raycast"); playAreaCursorBoundary.transform.SetParent(playAreaCursor.transform); playAreaCursorBoundary.transform.localPosition = localPosition; playAreaCursorBoundaries[index] = playAreaCursorBoundary; }
// Token: 0x0600189F RID: 6303 RVA: 0x00082D4C File Offset: 0x00080F4C protected virtual void CreateObjectInteractor() { this.objectInteractor = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, new object[] { base.gameObject.name, "BasePointerRenderer_ObjectInteractor_Container" })); this.objectInteractor.transform.SetParent(this.controllingPointer.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(VRTK_SharedMethods.GenerateVRTKObjectName(true, new object[] { base.gameObject.name, "BasePointerRenderer_ObjectInteractor_Collider" })); 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.controllingPointer.grabToPointerTip) { this.objectInteractorAttachPoint = new GameObject(VRTK_SharedMethods.GenerateVRTKObjectName(true, new object[] { base.gameObject.name, "BasePointerRenderer_ObjectInteractor_AttachPoint" })); 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); } this.ScaleObjectInteractor(Vector3.one); this.objectInteractor.SetActive(false); }
protected virtual void CreateTracer() { if (customTracer) { actualTracer = Instantiate(customTracer); } else { actualTracer = GameObject.CreatePrimitive(PrimitiveType.Cube); actualTracer.GetComponent <BoxCollider>().isTrigger = true; actualTracer.AddComponent <Rigidbody>().isKinematic = true; actualTracer.layer = LayerMask.NameToLayer("Ignore Raycast"); SetupMaterialRenderer(actualTracer); } actualTracer.transform.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "StraightPointerRenderer_Tracer"); actualTracer.transform.SetParent(actualContainer.transform); VRTK_PlayerObject.SetPlayerObject(actualTracer, VRTK_PlayerObject.ObjectTypes.Pointer); }
// Token: 0x0600193A RID: 6458 RVA: 0x00086B18 File Offset: 0x00084D18 protected virtual void DrawPlayAreaCursorBoundary(int index, float left, float right, float top, float bottom, float thickness, Vector3 localPosition) { GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube); gameObject.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, new object[] { base.gameObject.name, "PlayAreaCursorBoundary", index }); VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer); float x = (right - left) / 1.065f; float z = (top - bottom) / 1.08f; gameObject.transform.localScale = new Vector3(x, thickness, z); Object.Destroy(gameObject.GetComponent <BoxCollider>()); gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); gameObject.transform.SetParent(this.playAreaCursor.transform); gameObject.transform.localPosition = localPosition; this.playAreaCursorBoundaries[index] = gameObject; }
protected virtual void OnEnable() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); bodyPhysics = GetComponent <VRTK_BodyPhysics>(); movementSpeed = 0f; strafeSpeed = 0f; multiplySpeed = false; }
protected virtual void OnEnable() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); playArea = VRTK_DeviceFinder.PlayAreaTransform(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } headset = VRTK_DeviceFinder.HeadsetTransform(); if (!headset) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "HeadsetTransform", "Headset SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); bodyPhysics = GetComponent <VRTK_BodyPhysics>(); movementSpeed = 0f; strafeSpeed = 0f; blinkFadeInTime = 0f; lastWarp = 0f; lastFlip = 0f; lastSnapRotate = 0f; multiplyMovement = false; bodyCollider = playArea.GetComponentInChildren <CapsuleCollider>(); if (!bodyCollider) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_TouchpadMovement", "CapsuleCollider", "the PlayArea")); } }
/// <summary> /// The ValidLocation method determines if the given target is a location that can be teleported to /// </summary> /// <param name="target">The Transform that the destination marker is touching.</param> /// <param name="destinationPosition">The position in world space that is the destination.</param> /// <returns>Returns `true` if the target is a valid location.</returns> public virtual bool ValidLocation(Transform target, Vector3 destinationPosition) { //If the target is null, one of the player objects, or a UI Canvas then it's never a valid location if (target == null || VRTK_PlayerObject.IsPlayerObject(target.gameObject) || target.GetComponent <VRTK_UIGraphicRaycaster>()) { return(false); } bool validNavMeshLocation = false; if (navMeshData != null) { UnityEngine.AI.NavMeshHit hit; validNavMeshLocation = UnityEngine.AI.NavMesh.SamplePosition(destinationPosition, out hit, navMeshData.distanceLimit, navMeshData.validAreas); } else { validNavMeshLocation = true; } return(validNavMeshLocation && !(VRTK_PolicyList.Check(target.gameObject, targetListPolicy))); }
protected virtual void CreateCursor() { if (customCursor) { actualCursor = Instantiate(customCursor); } else { actualCursor = GameObject.CreatePrimitive(PrimitiveType.Sphere); actualCursor.transform.localScale = Vector3.one * cursorScale; actualCursor.GetComponent <Collider>().isTrigger = true; actualCursor.AddComponent <Rigidbody>().isKinematic = true; actualCursor.layer = LayerMask.NameToLayer("Ignore Raycast"); SetupMaterialRenderer(actualCursor); } cursorOriginalScale = actualCursor.transform.localScale; actualCursor.transform.name = string.Format("[{0}]GazePointerRenderer_Cursor", gameObject.name); actualCursor.transform.SetParent(actualContainer.transform); VRTK_PlayerObject.SetPlayerObject(actualCursor, VRTK_PlayerObject.ObjectTypes.Pointer); }
protected virtual void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); playArea = VRTK_DeviceFinder.PlayAreaTransform(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } headset = VRTK_DeviceFinder.HeadsetTransform(); if (!headset) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "HeadsetTransform", "Headset SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); }
/// <summary> /// The ValidLocation method determines if the given target is a location that can be teleported to /// </summary> /// <param name="target">The Transform that the destination marker is touching.</param> /// <param name="destinationPosition">The position in world space that is the destination.</param> /// <returns>Returns true if the target is a valid location.</returns> public virtual bool ValidLocation(Transform target, Vector3 destinationPosition) { //If the target is one of the player objects or a UI Canvas then it's never a valid location if (VRTK_PlayerObject.IsPlayerObject(target.gameObject) || target.GetComponent <VRTK_UIGraphicRaycaster>()) { return(false); } bool validNavMeshLocation = false; if (target) { NavMeshHit hit; validNavMeshLocation = NavMesh.SamplePosition(destinationPosition, out hit, navMeshLimitDistance, NavMesh.AllAreas); } if (navMeshLimitDistance == 0f) { validNavMeshLocation = true; } return(validNavMeshLocation && target && !(VRTK_PolicyList.Check(target.gameObject, targetListPolicy))); }
protected virtual void CreateCursor() { if (customCursor) { actualCursor = Instantiate(customCursor); } else { actualCursor = GameObject.CreatePrimitive(PrimitiveType.Sphere); actualCursor.transform.localScale = Vector3.one * (scaleFactor * cursorScaleMultiplier); actualCursor.GetComponent <Collider>().isTrigger = true; actualCursor.AddComponent <Rigidbody>().isKinematic = true; actualCursor.layer = LayerMask.NameToLayer("Ignore Raycast"); SetupMaterialRenderer(actualCursor); } cursorOriginalScale = actualCursor.transform.localScale; actualCursor.transform.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, gameObject.name, "StraightPointerRenderer_Cursor"); actualCursor.transform.SetParent(actualContainer.transform); VRTK_PlayerObject.SetPlayerObject(actualCursor, VRTK_PlayerObject.ObjectTypes.Pointer); }
protected virtual void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); playArea = VRTK_DeviceFinder.PlayAreaTransform(); 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."); } headset = VRTK_DeviceFinder.HeadsetTransform(); if (!headset) { Debug.LogError("No headset could be found. Have you selected a valid Headset 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); }
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; #if UNITY_2018_3_OR_NEWER objectInteratorRigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; #else objectInteratorRigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; #endif VRTK_PlayerObject.SetPlayerObject(objectInteractorAttachPoint, VRTK_PlayerObject.ObjectTypes.Pointer); } ScaleObjectInteractor(Vector3.one); objectInteractor.SetActive(false); }
protected override void OnEnable() { base.OnEnable(); VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer); customOrigin = (customOrigin == null ? VRTK_SDK_Bridge.GenerateControllerPointerOrigin(gameObject) : customOrigin); SetupController(); SetupRenderer(); activateDelayTimer = 0f; selectDelayTimer = 0f; hoverDurationTimer = 0f; currentActivationState = 0; wasActivated = false; willDeactivate = false; canClickOnHover = false; if (NoPointerRenderer()) { VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_PARAMETER, "VRTK_Pointer", "VRTK_BasePointerRenderer", "Pointer Renderer")); } if (activateOnEnable) { Toggle(true); } }
// Token: 0x060018F5 RID: 6389 RVA: 0x000852C0 File Offset: 0x000834C0 protected override void InitPointer() { this.pointerCursor = (this.customPointerCursor ? Object.Instantiate <GameObject>(this.customPointerCursor) : this.CreateCursor()); if (this.validTeleportLocationObject != null) { this.validTeleportLocationInstance = Object.Instantiate <GameObject>(this.validTeleportLocationObject); this.validTeleportLocationInstance.name = string.Format("[{0}]BasePointer_BezierPointer_TeleportBeam", base.gameObject.name); this.validTeleportLocationInstance.transform.SetParent(this.pointerCursor.transform); this.validTeleportLocationInstance.layer = LayerMask.NameToLayer("Ignore Raycast"); this.validTeleportLocationInstance.SetActive(false); } this.pointerCursor.name = string.Format("[{0}]BasePointer_BezierPointer_PointerCursor", base.gameObject.name); VRTK_PlayerObject.SetPlayerObject(this.pointerCursor, VRTK_PlayerObject.ObjectTypes.Pointer); this.pointerCursor.layer = LayerMask.NameToLayer("Ignore Raycast"); this.pointerCursor.SetActive(false); this.curvedBeamContainer = new GameObject(string.Format("[{0}]BasePointer_BezierPointer_CurvedBeamContainer", base.gameObject.name)); VRTK_PlayerObject.SetPlayerObject(this.curvedBeamContainer, VRTK_PlayerObject.ObjectTypes.Pointer); this.curvedBeamContainer.SetActive(false); this.curvedBeam = this.curvedBeamContainer.gameObject.AddComponent <VRTK_CurveGenerator>(); this.curvedBeam.transform.SetParent(null); this.curvedBeam.Create(this.pointerDensity, this.pointerCursorRadius, this.customPointerTracer, this.rescalePointerTracer); base.InitPointer(); }
protected override void OnEnable() { base.OnEnable(); VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer); customOrigin = (customOrigin == null ? VRTK_SDK_Bridge.GenerateControllerPointerOrigin(gameObject) : customOrigin); SetupController(); SetupRenderer(); activateDelayTimer = 0f; selectDelayTimer = 0f; hoverDurationTimer = 0f; currentActivationState = 0; wasActivated = false; willDeactivate = false; canClickOnHover = false; if (NoPointerRenderer()) { Debug.LogWarning("The VRTK_Pointer script requires a VRTK_BasePointerRenderer specified as the `Pointer Renderer` parameter."); } if (activateOnEnable) { Toggle(true); } }
// Token: 0x0600186C RID: 6252 RVA: 0x00081F84 File Offset: 0x00080184 protected virtual void OnEnable() { this.touchpadAxisChanged = new ControllerInteractionEventHandler(this.DoTouchpadAxisChanged); this.touchpadUntouched = new ControllerInteractionEventHandler(this.DoTouchpadTouchEnd); this.playArea = VRTK_DeviceFinder.PlayAreaTransform(); this.controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); this.controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); if (!this.playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "PlayArea", "Boundaries SDK" })); } VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); this.SetControllerListeners(this.controllerLeftHand, this.leftController, ref this.leftSubscribed, false); this.SetControllerListeners(this.controllerRightHand, this.rightController, ref this.rightSubscribed, false); this.bodyPhysics = base.GetComponent <VRTK_BodyPhysics>(); this.movementSpeed = 0f; this.strafeSpeed = 0f; this.multiplySpeed = false; }
private void CreateCollider() { generateCollider = false; generateRigidbody = false; 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."); return; } 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.FindChild("Test").gameObject.AddComponent <CapsuleCollider>(); bodyCollider.center = new Vector3(0f, 1f, 0f); bodyCollider.height = 1f; bodyCollider.radius = 0.05f; } if (playArea.gameObject.layer == 0) { playArea.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); } TogglePhysics(enableBodyCollisions); }
protected virtual void CreateObjectInteractor() { objectInteractor = new GameObject(string.Format("[{0}]BasePointer_ObjectInteractor_Holder", gameObject.name)); objectInteractor.transform.SetParent(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}]BasePointer_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 (grabToPointerTip) { objectInteractorAttachPoint = new GameObject(string.Format("[{0}]BasePointer_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); } var objectInteractorScale = 0.025f; objectInteractor.transform.localScale = new Vector3(objectInteractorScale, objectInteractorScale, objectInteractorScale); objectInteractor.SetActive(false); }
protected virtual bool ValidTarget(Collider collider) { return(!VRTK_PlayerObject.IsPlayerObject(collider.gameObject) && !(VRTK_PolicyList.Check(collider.gameObject, targetListPolicy))); }
protected virtual void Awake() { VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); headset = VRTK_SharedMethods.AddCameraFade(); playArea = VRTK_DeviceFinder.PlayAreaTransform(); }
public static void SetPlayerObject(GameObject obj, VRTK_PlayerObject.ObjectTypes objType) { if (!obj.GetComponent<VRTK_PlayerObject>()) { var playerObject = obj.AddComponent<VRTK_PlayerObject>(); playerObject.objectType = objType; } }
// Token: 0x06001943 RID: 6467 RVA: 0x00086E0A File Offset: 0x0008500A protected virtual bool ValidTarget(Collider collider) { return(!VRTK_PlayerObject.IsPlayerObject(collider.gameObject, VRTK_PlayerObject.ObjectTypes.Null) && !VRTK_PolicyList.Check(collider.gameObject, this.targetListPolicy)); }
private void Start() { VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); SetControllerListeners(controllerLeftHand); SetControllerListeners(controllerRightHand); }