Comments (4)
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.
from p5.xr.
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.
from p5.xr.
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?
from p5.xr.
Definitely! Do you want to propose one or two methods?
from p5.xr.
Related Issues (20)
- Oculus Quest Support HOT 8
- Get controller input HOT 5
- Release 0.4.0? HOT 4
- Am I using setViewerPosition correctly? HOT 1
- applyMatrix does not accept TypedArrays HOT 3
- Expand and improve unit testing
- Equirectangular sketch HOT 2
- Question/Feature Request HOT 1
- millis() and deltaTime not working in VR
- Issue for images
- iOS support for webXR coming *hopefully* with version 15.4 HOT 1
- Current release does not contain the fix for makeXRCompatible in p5vr.js
- Controller Input Rotation Data HOT 1
- Display VR scene under Enter VR button HOT 6
- Controller model representation HOT 2
- Give more informative error when `navigator.xr` is undefined
- Proposal: `vrConsoleDebug()`
- 2D drawing and coordinates should adjust for inline view
- Question - How to get info like rotation of device info, and extend draw distance etc. HOT 1
- Update the Library to use. P5 1.7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p5.xr.