Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

add support for angular velocity and acceleration #1915

Closed roshanch closed 6 years ago

roshanch commented 6 years ago

modifying API to receive angular velocity and acceleration. None of the demos are using onContollerEvent API. Open to suggestions for testing.

GearVRf-DCO-1.0-Signed-off-by: Roshan Chaudhari roshan.c@samsung.com

liaxim commented 6 years ago

The onControllerEvent was added in https://github.com/Samsung/GearVRf/pull/1254. You can see the issue it was in response to and additional information. It was an enhancement for a user. You might add something to gvr-controller.

liaxim commented 6 years ago

I believe we need to switch to custom events in GVRGearCursorController. They may also wrap the MotionEvents from GVRCursorController for the convenience of clients like the GVRViewSO. Probably oversimplifying it but a MotionEvent cannot carry all the information we need. So we have the onContollerEvent hack.

NolaDonato commented 6 years ago

Sounds good to me. Can we subclass MotionEvent?

liaxim commented 6 years ago

No, it is a final class.

roshanch commented 6 years ago

added sample code for controllerEvent in gvr-controller, was able to retrieve angular velocity but the acceleration is coming 0 from platform library. Moiz is going to check with HQ.

roshanch commented 6 years ago
        mActivity.getEventReceiver().addListener(new GVREventListeners.ActivityEvents() {
            @Override
            public void onControllerEvent(Vector3f position, Quaternionf orientation, android.graphics.PointF touchpadPoint, boolean touched, Vector3f angularAcceleration,
                                          Vector3f angularVelocity) {
                Log.e("TAG", ">> onControllerEvent: position " + position);
                Log.e("TAG", "<< onControllerEvent: orientation " + orientation);
                Log.e("TAG", ">> onControllerEvent: angularAcceleration" + angularAcceleration);
                Log.e("TAG", "<< onControllerEvent:  angularVelocity " + angularVelocity);
            }
        });
liaxim commented 6 years ago

Planning to merge on Monday.