Discussions

Ask a Question
Back to All

Deactivating GameObject on Use does not end Touch's hover state

I have a script attached to a GameObject that when a motion controller is colliding with the object and presses the Use button the object is deactivated.

When using Oculus Touch controllers this causes the controller to not stop it's hover state "vibrate" and the controller seems to still consider itself as hovering over the object. In my case this results in me still being able to "pick up" the parent of the now disabled game object, no matter how far away the parent object is.

Here is my script that deactivates the object on Use:

private void OnTriggerStay(Collider other) {
if (other.transform.parent.GetComponent()) {
NVRHand hand = other.transform.parent.GetComponent();
if (hand.UseButtonPressed) {
QuestionContainer.SetActive(true);
AnswerContainer.SetActive(true);
transform.parent.gameObject.SetActive(false);
}
}
}

Is this a bug or is there another way I should go about achieving this interaction that will properly end the controller's hover state?