anaglyphs / lasertag

A mixed reality multiplayer game for Oculus Quest 3
https://anagly.ph
GNU General Public License v3.0
8 stars 3 forks source link

Depth raycasting does not work over QuestLink #3

Open trev3d opened 2 months ago

bschoun commented 2 months ago

This almost mostly works now! Here's the issue I've been having:

When I run the DepthRaycast Example scene, I get the following error about half of the time: Compute shader (DepthCast): Property (EnvDepthTextureCS) at kernel index (0) is not set

This pauses the editor. However, if I un-pause it, it seems to carry on like it should.

From some experimentation, it seems to have to do with line 221 of DepthCast.cs (computeShader.SetTextureFromGlobal(0, EnvDepthTextureCS, depthTextureId);) not taking effect before the RaycastBlocking function is called.

I tried adding a private bool variable that would be set to true at the completion of the UpdateCurrentRenderingState() function, and made the RaycastBlocking() function return early if the variable was false. This didn't seem to work. However, if I use a coroutine to delay setting that variable to true by 1 second, it seems to consistently work.

Happy to submit a pull request if desired, but I figure you might have a better idea for a more elegant solution. I haven't tested to see if this affects the built version at all.