weixin_39982017
weixin_39982017
2020-12-26 09:33

Problem With onTouchEvent and button presses

Hi, I'm trying to get some code going using the Samsung controller to navigate the scene. I want use the touchpad on the controller for player movements. I'm intercepting events in the Activity's onTouchEvent call.

public boolean onTouchEvent(MotionEvent event) {
    Log.d("MyActivity", "onTouchEvent: " + event);
    ...do something...
    return super.onTouchEvent(event);
}

I'm getting input okay while I'm not pressing either the trigger or the touchpad button itself, but while either of those are depressed the x,y co-ordindates coming back are always x=1280.0 y=720.0. Needless to say this is making it rather awkward when I don't want the player to become stuck whenever a button's depressed.

Is this the right way to receive this input, I would have expected the onEvent callback in GVRCursorController.ControllerEventListener to have delivered these through getMotionEvent(), but I'm not getting any motion events at all from the controller.

Also I can't find any way of getting the orientation of the controller, other than through attaching a GVRSceneObject to it and reading back this objects orientation, surely there must be a proper interface to retrieve the controllers orientation?

该提问来源于开源项目:Samsung/GearVRf

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答