# VR - Sphere trace disrupts the camera, and doesnt work

**URL:** <https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [March 24, 2024, 9:56pm UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548 "2024-03-24T21:56:02Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![tekmoh777](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tekmoh777/32/914741_2.png) [@tekmoh777](https://forums.unrealengine.com/u/tekmoh777)\
**Post date:** [March 24, 2024, 9:56pm UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/1 "2024-03-24T21:56:02Z")

</div>

Hello everybody. I am new here, thanks in advance for welcoming me 🙂  
I have a project that i started up as TopDown template, then I have migrated it into VR Template, because i wanted to try a topdown game with a VR camera.  
The version I use is Unreal 5.3.2

When I try and use the Nodes “Sphere Trace” or any “Trace” node, that messes up the camera.  
I have tried the nodes in all the other non-VR templates (FPS, ThirdPerson, Topdown,etc…) everything works.  
But in the VR Template and in my TopDown migrated into VR Template, that doesnt work at all.  
Sometimes it crashes the game preview (in selected viewport), this is the log i get after pressing X for my “Sphere trace” action crashing :

> PIE: Play in editor total start time 0,125 seconds.  
> LogBlueprintUserMessages: [VRPawn\_C\_0] PRESS X  
> LogOutputDevice: Warning: Script Stack (0 frames) :  
> LogStats: FPlatformStackWalk::StackWalkAndDump - 0.023 s  
> LogOutputDevice: Error: === Handled ensure: ===  
> LogOutputDevice: Error: Ensure condition failed: DepthStencilRenderTarget.DepthStencilTarget-\>GetNumSamples() == NumSamples [File:D:\build++UE5\Sync\Engine\Source\Runtime\RHI\Private\RHI.cpp] [Line: 1606]  
> LogOutputDevice: Error: Stack:  
> LogOutputDevice: Error: [Callstack] 0x00007ffab6b8aaa6 UnrealEditor-RHI.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa89616f0c UnrealEditor-RenderCore.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa89615927 UnrealEditor-RenderCore.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa895dc2e2 UnrealEditor-RenderCore.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa8964f237 UnrealEditor-RenderCore.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa895f3414 UnrealEditor-RenderCore.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa76ad8cd5 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa76ad8a7c UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa76ab80e2 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa76b008c2 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa76ac8b60 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa76caf773 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa770e4e32 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffa770d8667 UnrealEditor-Core.dll!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffac7ef53e0 KERNEL32.DLL!UnknownFunction   
> LogOutputDevice: Error: [Callstack] 0x00007ffac818485b ntdll.dll!UnknownFunction   
> LogStats: SubmitErrorReport - 0.000 s  
> LogRHI: Error: Breadcrumbs ‘RenderingThread’  
> Context 1/2  
> 00 Scene  
> 01 Translucency

Thanks !

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 25, 2024, 12:29am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/2 "2024-03-25T00:29:36Z")

</div>

Hey there @tekmoh777! Welcome to the community! Looks like a depth pass issue, are you using custom depth stencils?

When you mention the traces “mess up the camera”. Do you mean the crash is caused when debug traces (the visible lines) are trying to render?

Does it still crash if the debug visuals aren’t enabled?

---

<div class="post-metadata">

**Author:** ![tekmoh777](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tekmoh777/32/914741_2.png) [@tekmoh777](https://forums.unrealengine.com/u/tekmoh777)\
**Post date:** [March 25, 2024, 8:16am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/3 "2024-03-25T08:16:31Z")

</div>

Hello SupportiveEntity, thanks for replying.

> Does it still crash if the debug visuals aren’t enabled?

You found it right !  
When I disable debug drawing in the node “Sphere trace…”, it doesnt crash or mess camera anymore 👍

However, I have never set up personnally “custom depth stencils” in my project.  
It seems like VR template has set up something about “custom depth stencils” that we are not aware of. In fact, I have tried every template, and only VR Template reproduces the problem.  
And I have found this post too here, same problem and using VR template “[MetaHuman with VR settings crashes edtior with DepthStencilRenderTarget.DepthStencilTarget-\>GetNumSamples() == NumSamples](https://forums.unrealengine.com/t/metahuman-with-vr-settings-crashes-edtior-with-depthstencilrendertarget-depthstenciltarget-getnumsamples-numsamples/720839)”.

I dont know yet what is custom depth stencils, but i need to understand how and why its configured in VR Template, and if i need it in my project, because Debug Drawing for Sphere Trace functions seems really useful .

What do you think about that?

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 25, 2024, 10:15am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/4 "2024-03-25T10:15:17Z")

</div>

Custom Depth Stencils are primarily used for masking objects through walls or changing the way the depth of that masked object appears on the depth map. It’s often used for highlighting things through other meshes. I am going to set up a test bed to replicate this to see if I can discern where the depth buffer is being altered. Which HMD are you using for reference?

---

<div class="post-metadata">

**Author:** ![tekmoh777](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tekmoh777/32/914741_2.png) [@tekmoh777](https://forums.unrealengine.com/u/tekmoh777)\
**Post date:** [March 25, 2024, 11:16am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/5 "2024-03-25T11:16:56Z")

</div>

I am very interested in the results of your tests.

Regarding the HMD, i dont use yet a HMD.  
The purpose is to build a prototype before getting the HMD. (the prototype needs only the VR camera, and no VR interactions like VRGrab etc.)

The fail occurs in 2 projects :

- the vanilla VR template. When i add my nodes into the blueprint “VRPawn”, and press assigned key in game preview for event to launch
- my own project which i started from TopDown template and then migrated to VR Template. The main Blueprint remains my TopDown blueprint, with its own classic camera. And i placed a VRPawn camera (slighly customized) that is quite useless for the moment, until i can try with the future HMD. I added the nodes in the main blueprint (TopDownCharacter). The game runs decently (character, non-VR camera, etc…), until i try Sphere trace with Debug Draw.

 ![IMG_4656](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/b/04b6791baf4f58e5b602620674390afbd223cfb8.jpeg)

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 26, 2024, 8:35am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/6 "2024-03-26T08:35:47Z")

</div>

I can’t seem to replicate the issue itself. Does any debug line being rendered cause it? May I know your specs?

---

<div class="post-metadata">

**Author:** ![tekmoh777](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tekmoh777/32/914741_2.png) [@tekmoh777](https://forums.unrealengine.com/u/tekmoh777)\
**Post date:** [March 26, 2024, 9:27am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/7 "2024-03-26T09:27:32Z")

</div>

I have not set up debug lines manually. Maybe there is debug line from VR template ? Where should i look ?

Regarding the specs, i have reproduced the same crash on a second PC, it crashed and i sent the report.

My specs are :

- cpu : i7 11390H
- gpu : Mesa Intel Xe Graphicd
- Ram : 16gb

The other pc is like :

- cpu : i5 3570
- gpu : nvidia 960
- ram : 8gb

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 27, 2024, 8:49am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/8 "2024-03-27T08:49:46Z")

</div>

I’m getting reports of this error in other contexts, but still can’t replicate it. Trying to dig a bit deeper, though this might be an environmental concern.

Are you by chance using a metahuman?

For example:

> [@MetaHuman with VR settings crashes edtior with DepthStencilRenderTarget.DepthStencilTarget-\>GetNumSamples() == NumSamples](https://forums.unrealengine.com/t/metahuman-with-vr-settings-crashes-edtior-with-depthstencilrendertarget-depthstenciltarget-getnumsamples-numsamples/720839/4):
>
> I am using MetaHumans and VR in a project built with UE 5.3.2 source code. When I run the project as ‘Play in standalone’, I get the same error log. The interesting thing is that it doesn’t crash, so it’s playable. [2024.03.04-06.18.39:599][3]LogStats: FPlatformStackWalk::StackWalkAndDump - 0.457 s [2024.03.04-06.18.39:601][3]LogOutputDevice: Error: === Handled ensure: === [2024.03.04-06.18.39:602][3]LogOutputDevice: Error: [2024.03.04-06.18.39:602][3]LogOutputDevice: Error: Ensur…

---

<div class="post-metadata">

**Author:** ![tekmoh777](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tekmoh777/32/914741_2.png) [@tekmoh777](https://forums.unrealengine.com/u/tekmoh777)\
**Post date:** [March 27, 2024, 10:12am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/9 "2024-03-27T10:12:57Z")

</div>

No, i dont use Metahumans.  
Have you tried to reproduce it on VR template without HMD ?  
Because it really seems related to VR template, and i have not installed any third party driver for VR (like Windows Mixed Reality or other) :

- VR template
- No HMD
- No third party VR driver
- No MetaHumans
- Sphere trace with Debug Draw on VRPawn (or in topdown character)
- Unreal Editor 5.3.2
- Windows 11 professionnal
- directx 12
- .net 4.0.30319

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 29, 2024, 4:00am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/10 "2024-03-29T04:00:02Z")

</div>

I’ve tried with a Quest 2 through OpenXR, standalone without the HMD, and PIE without the HMD in windows 10 and DX12. After firing the debug draw there are no errors, stalls, or anything. It might be best to report the bug as it’s likely something environmental.

[https://www.unrealengine.com/en-US/support/report-a-bug](https://www.unrealengine.com/en-US/support/report-a-bug)

---

<div class="post-metadata">

**Author:** ![tekmoh777](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tekmoh777/32/914741_2.png) [@tekmoh777](https://forums.unrealengine.com/u/tekmoh777)\
**Post date:** [March 29, 2024, 12:41pm UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/11 "2024-03-29T12:41:53Z")

</div>

Thank you for the efforts, you did your best and I appreciate.  
Now I’ll try to report that behavior as a bug as you suggest

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 30, 2024, 4:11am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/12 "2024-03-30T04:11:33Z")

</div>

Thanks! If you find a variable that can help reproduction, or any new information please let me know!

---

<div class="post-metadata">

**Author:** ![Cgi\_Layers](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cgi\_Layers](https://forums.unrealengine.com/u/Cgi_Layers)\
**Post date:** [September 10, 2024, 11:57am UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/13 "2024-09-10T11:57:34Z")

</div>

Have this happening sometimes too in the default VR template

---

<div class="post-metadata">

**Author:** ![Reahreic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/reahreic/32/911691_2.png) [@Reahreic](https://forums.unrealengine.com/u/Reahreic)\
**Post date:** [November 7, 2024, 2:49pm UTC](https://forums.unrealengine.com/t/vr-sphere-trace-disrupts-the-camera-and-doesnt-work/1770548/14 "2024-11-07T14:49:34Z")

</div>

If it helps, we encountered this issue when we installed the Ultra Leap hand tracking plugin.

If you run the editor via local windows debugger you can press Visual Studios ‘Continue’ button to bypass the lockup and continue working. The error will only throw on first run of the editor and VR PIE, then won’t trigger again until re-opening the editor.

Update: Specifically, this error only occurs when we use a `Widget Interaction Component` **and** set `Details > Debugging > ShowDebug` to true.
