Closed SteveGreatApe closed 6 years ago
This may be due to a change in the Oculus SDK. We upgraded to a new one and that may be why it is returning the previous touchpad point. onControllerEvent is called with EXACTLY the data we get from Oculus with no intervention.
There are other ways to listen for controller events that might be more suitable for your application. These methods will work with the gaze controller, the mouse, the gamepad and the Gear.
You can register a ControllerEventListener with GVRCursorController.addControllerEventListener and it will call the onEvent function every frame with the GVRCursorController and whether or not it is touched. You can get the position of the controller in world space with GVRCursorController.getOrigin(). You can get the orientation with GVRPicker.getPickRay. You can get all the motion and key events generated that frame with GVRCursorController.getMotionEvents(), GVRCursorController.getKeyEvents().
Another way to get controller information is to listen for touch events. The ITouchEvents interface will call onEnter, onExit and onInside just like IPickEvents. In addition you get onTouchStart and onTouchEnd events when the user started touching an object and when they stopped. You can listen for these events with GVRCursorController.addPickEventListener.
If you really want to use onControllerEvent (which only works for the Gear, not the others) I can add an argument which indicates whether the pad is being touched or not.
I added an extra argument to onControllerEvent in PR #1646 (just now). Pull it again and you should a boolean parameter to indicate touch / no touch.
Fixed by #1646
This bug is on a pull of the source from 2nd Jan 2017.
I'm monitoring the touchpad with the onControllerEvent from GVREventListeners.ActivityEvents, in 4.0 I'd get a {0.0,0.0} reading to indicate no touch. Now I just get keeping the values from the last touch location when there's no touch, so it's impossible to know when the user has stopped touching the pad. It does occasionally return zero values, but this seems to be when I've left it unused for a bit and woken it up after the screen had powered off.
I've set a breakpoint in onDrawFrame() from GearCursorController.java and can confirm the invalid old position is being retrieved from the following call in onDrawFrame().