Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

How do you specify the view? #318

Open
bsabiston opened this issue Apr 20, 2018 · 4 comments
Open

How do you specify the view? #318

bsabiston opened this issue Apr 20, 2018 · 4 comments

Comments

@bsabiston
Copy link

With GoogleVR, how do you specify the view -- ie, the point at which the camera is looking, the camera position, the relative scale of the world? Currently I am working with the default settings, but everything is at a very small scale. Are there functions to set these things?

@Performador
Copy link

The camera view for left and right eyes are driven from head transformation. The world to head transformation is given by:

gvr_get_head_space_from_start_space_transform

You need to multiply that with the eye from head transform. You can adjust the eye from head transform to model the interpupillary distance. The wider apart the eyes are the smaller the world will look.

The default values provided by GVR typical averages. The world units are in meters.

https://developers.google.com/vr/reference/ios-ndk/group/headtracking

@bsabiston
Copy link
Author

bsabiston commented Apr 21, 2018

Thanks -- but I am not sure that answers my question. Are you just forced to accept the world space that GoogleVR uses, or can you place the GoogleVR "head" someplace in your game world? Maybe I am asking if you can set the transformation for the "start space". Do you understand what I mean? If I have a pre-existing game that I am adapting to GoogleVR, do I have to shrink everything down and orient it to match the GoogleVR world space, or can I tell GoogleVr "this is where you are in the world, this is where you are looking by 'default'". I see a lot about reading where the head and eyes are looking -- but how do you SET those things initially? I must be misunderstanding how it works...

@Performador
Copy link

You can apply your own start space from world transformation on top of the head transform that GVR gives you.

Let's say you would like the head to be at position (T) and orientation (R). Then your world from start transformation becomes T * R. So the matrices you want to apply for an eye become:

projection * eye_from_head * head_from_start * start_from_world
projection * eye_from_head * head_from_start * inv(T * R)

@bsabiston
Copy link
Author

Thanks! Finally got a chance to try this and it works great.

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

No branches or pull requests

2 participants