0

I'm creating a Vr-world with unity for the OculusGo. I'm using the OVR CameraRig and the Oculus utilities. I have a Model that is rotating by the following script:

public class rotation_2 : MonoBehaviour
{
public bool _shouldRotate = true;

void Update()
   {
    if (_shouldRotate)
        transform.Rotate(new Vector3(0, Time.deltaTime * 8, 0));
   }

void OnMouseDown()
   {
    if (_shouldRotate)
        _shouldRotate = false;
   }
}

Right now tho model rotates and stops rotating when the Mousebutton is pressed. It should continue rotating when the Mousebutton is released - but it doesn't. Why?

In the next step i Want to change from the Mouse to the OculusGo-controller. So it's not the Mousebutton that causes the "rotation-stop" but the OculusGo-controller.

Thank You and Merry Christmas!

foliran
  • 75
  • 6

1 Answers1

0

Right now tho model rotates and stops rotating when the Mousebutton is pressed. It should continue rotating when the Mousebutton is released - but it doesn't. Why?

You're using the OnMouseDown event. That event is always going to fire when the mouse button is pressed, thus setting _shouldRotate to false and stopping the movement. You need to use the OnMouseUp event, that will fire when the mouse button is released.

In the next step i Want to change from the Mouse to the OculusGo-controller. So it's not the Mousebutton that causes the "rotation-stop" but the OculusGo-controller.

For this next step, you need to find the OculusGo Documentation and find the events that are being fired when a button is pressed and released. You will have to find something similar to OnMouseUp and; probably, check an argument sent to the function to identify the button that fired the event.

Hope this helps and merry christmas to you too.

ikerbera
  • 195
  • 1
  • 3
  • 15