Closed frntendev closed 6 years ago
Can you explain a little more what you're trying to do? Do you just want the camera to rotate constantly without stopping?
If so, you can use the empty render() method in your client.js file. The camera is just a Three.js object, so you could do something like vr.camera.rotation.y = SPEED * TIME_SINCE_APP_STARTED
, where SPEED
is some multiplier that determines how fast the camera rotates (in Radians / ms) and TIME_SINCE_APP_STARTED
is the current time in ms, minus some time you took before the vr.start()
call.
As of the current React-VR version (1.4), there is both scene and camera. Which one should we use?
vr.scene.rotation.y = SPEED * TIME_SINCE_APP_STARTED
vr.camera().rotation.y = SPEED * TIME_SINCE_APP_STARTED
When I run this using vr.camera().rotation.y, it does not seem to work.
For reference:
import {VRInstance} from 'react-vr-web';
function init(bundle, parent, options) {
const vr = new VRInstance(bundle, 'dataVR', parent, {
// Add custom options here
...options,
});
vr.render = function() {
// Any custom behavior you want to perform on each frame goes here
vr.scene.rotation.y = -0.2
};
// Begin the animation loop
vr.start();
return vr;
}
window.ReactVR = {init};
Could be implemented with custom controls scheme in React 360
Could you please elaborate on that.. I used either vr.camera.rotation.y= n or vr.scene.rotation.y=n but nothing seems to work.. any help?
Could you please elaborate on that.. I used either vr.camera.rotation.y= n or vr.scene.rotation.y=n but nothing seems to work.. any help?
vr.scene.rotation.y
work on me.
You can console the vr
to know what inside.
Hello, what is the best way to rotate camera infinitely at the first of project?