How to check if device is Quest 2 vs Quest 3?

For the Web XR Plane Tracking script I want to only use ‘Mesh Data’ on Quest 3 and only ‘Plane Data’ for Quest 2. Never both enabled at the same time.

Is it possible to see which type of device is accessing the website and make the selection at runtime?

Original Post on Discord

by user 264626421891072001

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

On Quest browser this is part of navigator.userAgent (will contain info about browser version and also Quest 2/3/Pro).

Could you say a bit more about the usecase? When I implemented that I thought about adding more options but found that the current state works fine for the usecases I imagined, so if you can elaborate I may be able to improve that in the core too.

My experience involves applying a shader to the surfaces of a person’s environment. I’m trying to provide the best experience for people with Quest 3 by mapping to ‘Mesh Data’ because it provides a higher resolution mesh of the room. Quest 2 is able to detect rooms with ‘Plane Data’ which is lower resolution.

My issue is when they are both enabled and they occlude each other.

So I wanted to be able to understand when a device is quest 3 enable Mesh Data and when on quest 2 use Plane Data.

by user 264626421891072001

OK, understood. So far I didn’t have a problem when both are on, but I see what you mean.
Does the userAgent check I mentioned above help you for now?

Thanks, is there any documentation how to use it properly? or an example script?

by user 264626421891072001

const isQuest2 = navigator.userAgent.includes("Quest 2");

Thank you!

by user 264626421891072001