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

VR Style Camera (Aframe implementation or ArrayCamera/StereoCamera from three #102

Open
4 tasks done
Truemedia opened this issue May 28, 2023 · 3 comments
Open
4 tasks done

Comments

@Truemedia
Copy link
Collaborator

Description

I'm looking to migrate an Aframe project to tresJS to benefit from vue bindings however I'm struggling to setup the camera to work with a VR headset.

I've attempted loading the ArrayCamera and StereoGame classes built-in to threeJS and using the extend method in TresJS to be able to load them as components such as and but nothing works. I either get a blank black screen or a bluescreen with a line through it (when using the default example from the TresJS starter repo)

This is after being able to use without any issues and just swapping out the camera used. Would appreciate any ideas or info how to implement this thanks.

Suggested solution

Implement Array or StereoCamera as Tres JS native component preconfigured to work with VR.

Alternative

No response

Additional context

No response

Validations

@Truemedia
Copy link
Collaborator Author

Iv'e figured out how to do this! and it works with only a small amount of code. Here goes the gist of the instructions for anyone that stumbles across this in future.

First you have to have to be able to run your site over HTTPS. VR functionality is not supported otherwise so you can install this vite plugin for the tres starter to server it with an SSL certificate https://www.npmjs.com/package/vite-plugin-mkcert

Next you have to add the Three JS vr button and hook it into Tres JS state using the useTres function (simply add state. on all variables within the Three JS code snippet).

Then add --host into the command under the scripts > dev section of your package.json

Rerunning vite and entering the IP address/port that vite gives you in the terminal for network then presents you with the normal TresJS pespective camera and clicking the VR button then goes into VR mode!

15 mins or less to setup

Copy link
Member

@Truemedia should we move this to the XR package?

@Truemedia
Copy link
Collaborator Author

@Truemedia should we move this to the XR package?

Yeh makes sense to move it

@alvarosabu alvarosabu transferred this issue from Tresjs/tres Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants