What's the correct way to edit the WebXR.ts file?

I’m trying to disable hit-test and the reticle in an AR scene but even when I delete the code in the WebXR.ts file, it still shows up in the builds.

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?

How it works:
Reply to the messages of the bot that end with a thread_id to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.

Help requested: please wait a moment…

It appears there was an issue trying to quote the specific method from the document. To disable hit-test and the reticle in an AR scene with the Needle Engine, you’ll typically want to look for the setReticleActive function of the WebAR class. You would call this method with a false argument to disable the reticle.

If you’ve already attempted to remove or modify the code without success, make sure you are rebuilding your AR scene after making changes to the files, as the engine may be using a cached version of your project. You should also check if there are any other parts of your code or the engine that re-enable the reticle or hit-test features.

If you continue to encounter difficulties, please ensure that you are following the correct workflow for editing the code in the Needle Engine. If necessary, refer to the Needle Engine documentation or contact Needle Engine support for more detailed assistance.

1 messages left GPT 4
Thanks for your feedback!

Hi, we’re currently in the progress of refactoring WebXR which will make this much easier.

Could you share a bit about your usecase for why you want to disable it and what you want to do?

Sure thing, figured it be easier to record a video and do a voice over. Here it is

by user 264626421891072001

Ah great thanks for the video.

I think what you can do right now before the refactor lands in a public version is getting your WebXR component using a little script and then setting allowARPlacementReticle to false on the webxr component (this option is not exposed in the unity editor right now but accessible from typescript)

The upcoming version of our webxr system will just expose this in unity so you will be able to just disable it then without having to write any code :slightly_smiling_face:

So create a new script, have it reference the webxr component, set ‘allowARPlacementReticle’ to fasle and attach it to the same webxr object? I’m new to this so please bare with me. Thanks!

by user 264626421891072001

Yes that would be one (good) way :slightly_smiling_face:

Thanks! I’ll give it a try

by user 264626421891072001

Hi @brendanluu how did it go?

Getting rid of the reticle worked! However, when I click, the scene origin still changes. Is this related to the ARSessionRoot? Is it possible to get rid of reseting the origin on click?

by user 264626421891072001

Hey just following up on this. Is there a way to disable placing the session root from the hit test? I’m happy to disable hands/controllers all together if necessary.

by user 264626421891072001