- Home /
Question by
mbrklspm · May 08, 2018 at 10:37 AM ·
collisioncollision detectionoculusoculus rift
How to destroy GameObject with Oculus Touch GazeRing?
I integrated Oculus VR in a simple scene which consists basically of only a sphere:
Now I want to "destroy" the sphere when point-selecting it with the right-hand Oculus Touch device. The Blue GazeRing hangs under the RightHandAnchor.
The Sphere, called and tagged Ball, is configured as follows:
The InputManager GameObject has a component "Controller Input (Script)":
public class ControllerInput : MonoBehaviour {
public Transform pointerTransform;
void Update () {
if (OVRInput.Get(OVRInput.Button.SecondaryHandTrigger))
{
RaycastPointer();
}
}
private void RaycastPointer()
{
RaycastHit selection;
if (Physics.Raycast(pointerTransform.position, pointerTransform.forward, out selection))
{
if (selection.collider.gameObject.CompareTag ("Ball"))
{
Destroy(selection.collider.gameObject);
}
}
}
}
As variable pointerTransform, the GazeRing is given.
However, if I try to "shoot" the sphere with the trigger button. Nothing happens.
Can anyone advice?
Thanks in advance!
screenshot-1.png
(265.3 kB)
ball-inspector.png
(41.6 kB)
Comment