Last active
April 4, 2022 00:49
-
-
Save 314pies/211661dc6485365bd0c71a2e430699d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Transform handTransform; | |
void Update() | |
{ | |
if (OVRInput.GetDown(OVRInput.Button.PrimaryHandTrigger)) | |
{ | |
//Do something when click the button on the VR controller | |
} | |
//Get thumbstick input | |
Vector2 primaryAxis = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick); | |
Vector2 secondaryAxis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick); | |
//Create raycast from VR hand (For virtual pointer) | |
RaycastHit hit; | |
if (Physics.Raycast(handTransform.position, handTransform.forward, out hit, 25.0f)) | |
{ | |
GameObject hittedGameObject = hit.transform.gameObject; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment