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

Need to find decent starting position #4

Closed
stalgiag opened this issue Mar 29, 2019 · 4 comments · Fixed by #28
Closed

Need to find decent starting position #4

stalgiag opened this issue Mar 29, 2019 · 4 comments · Fixed by #28
Milestone

Comments

@stalgiag
Copy link
Owner

Currently there is a call to translate in the draw loop of most of the manual tests that positions the viewer in a location that I just attempted to make 'feel okay'. This is wrong. The todo here is to figure out what translation feels natural enough so that example sketches from non-immersive p5 sketches look okay from the beginning. This translation should then be accounted for automatically by the library. The xrFrameOfRef itself may need to be modified.

@stalgiag stalgiag added this to the pre-alpha milestone Mar 29, 2019
@vedhant
Copy link
Contributor

vedhant commented May 23, 2019

The starting position of the viewer is the same as a typical webgl default camera position.

  • The viewer is placed at the origin of the world.
  • the zx plane of world is the physical horizontal plane (perpendicular to gravity) of the viewer.
  • y axis of the world is opposite to gravity. (towards sky)
  • -z axis is the component of starting forward vector of viewer onto the zx plane.
  • x axis is the starting right vector of viewer.
let vrGlobals = {
  counter: 0
};

function preload() {
  createVRCanvas();
}

function setup() {
  setVRBackgroundColor(200, 0, 150);
}

function draw() {
  fill(0, 255, 0);
  checkSync();
  vrGlobals.counter++;
  
  translate(0, 0, -10);
  strokeWeight(0.1);
  
  box(5);
}

function checkSync() {
  if(vrGlobals.counter === 0) {return;}

  if(vrGlobals.counter !== frameCount) {
    console.error('Out of sync!');
  }
}

This example places a box on the negative z axis. So when the user first goes to VR mode, the cube will be directly visible to the front just by moving the head up and down (the head should be facing front perpendicular to gravity). The movement of head up and down from starting position will allow aligning the viewer's forward vector along the -z axis.

@stalgiag
Copy link
Owner Author

Right I understand. My main concern is whether every frame the camera should be shifted in the z-vector. If I draw a sphere at 0,0 then where do I expect that to be in relation to my body to most effectively match the experience of WebGL mode on the screen. This isn't a technical question as much as a question of design and achieve a good 'feeling' out of the box for the user.

@vedhant
Copy link
Contributor

vedhant commented May 29, 2019

As we discussed, how do you feel about giving user the capability to specify starting position or interestingly, let the user decide the viewers position at any point? The api for this could be very similar to p5 camera or maybe we can attach a viewer to a perspective camera?

@stalgiag
Copy link
Owner Author

stalgiag commented May 30, 2019

Definitely! Do you want to propose one or two methods?

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

Successfully merging a pull request may close this issue.

2 participants