Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GVRPicker.pickVisible #765

Merged
merged 9 commits into from
Aug 11, 2016
Merged

Adding GVRPicker.pickVisible #765

merged 9 commits into from
Aug 11, 2016

Conversation

NolaDonato
Copy link
Contributor

The picker internally has access to the list of visible objects compiled
by the renderer each frame. This function provides access to that list from Java.

This feature is added in response to issue #762

GearVRf-DCO-1.0-Signed-off-by: Nola Donato nola.donat@samsung.com

The picker internally has access to the list of visible objects compiled
by the renderer each frame. This
The picker internally has access to the list of visible objects compiled
by the renderer each frame. This
@rahul27
Copy link
Contributor

rahul27 commented Aug 3, 2016

I assumed that we were planning to move away from the polling model proposed in this change to an event based model for picking.

If we were to implement this change to fit the events model then it would make sense to create a new type of picker like a box or frustum picker to the camera rig to listen for IPickEvents.

first cut at picking events for view frustum. this version just picks to
the scene's main camera view frustum. picking to an arbitrary frustum is
not working yet.
@NolaDonato
Copy link
Contributor Author

OK I added GVRFrustumPicker which will generate the same pick events as GVRPicker

@rahul27
Copy link
Contributor

rahul27 commented Aug 5, 2016

👍 Looks good. Tried this with the eye picking sample, changed the GVRPicker to GVRFrustumPicker to test.

GVRPicker worked correctly when attached to the camera but not when
attached to a scene object. To fix this bug I changed the native picker
to use world coordinates instead of camera coordinates for the ray. This
allows any scene object to become the origin of the ray more easily.
GVRSphereCollider was not honoring the setRadius value so I fixed that.
I added support to GVRFrustumPicker for a user-defined frustum, not just
the current camera.
dir.mul(view_matrix);
if (!mCuller.isSphereInsideFrustum(center.x, center.y, center.z, dir.length()))
{
Log.d("Picker", "Picker: outside %s (%f, %f, %f) %f", sceneObj.getName(), center.x, center.y, center.z, dir.length());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove the logging. Can be done later of course.

@liaxim
Copy link
Contributor

liaxim commented Aug 11, 2016

Should we document that probably people want to add the component to mainScene.getMainCameraRig().getHeadTransform().getOwnerObject()? Considering how obfuscated that looks, should we "api"-fy the common use-case?

@liaxim
Copy link
Contributor

liaxim commented Aug 11, 2016

If I modify the eye-picking sample accordingly and use setFrustum(90, 1, znear, zfar) what should I be seeing? znear and zfar are retrieved from the main camera rig. I kind of expect all boards and bunnies to be red but that is not what happens.

@liaxim
Copy link
Contributor

liaxim commented Aug 11, 2016

Looks good. Will merge Thursday afternoon if there are no further comments.

@NolaDonato
Copy link
Contributor Author

setFrustum(90, 1, near, far) should show all the bunnies as red. If that is not happening it is a bug. I will look at it.

@liaxim liaxim merged commit f7bd32c into Samsung:master Aug 11, 2016
@NolaDonato
Copy link
Contributor Author

GVRCameraRig.getHeadTransformObject is protected. I will make it public. That is the accessor for the head transform owner object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants