oculus-samples / Unity-DepthAPI

Examples of using Depth API for real-time, dynamic occlusions
Other
167 stars 24 forks source link

Possible to do collision detection? #32

Closed dogadogan closed 3 months ago

dogadogan commented 3 months ago

Hi all,

Is it possible to detect collisions between virtual and real-world objects using Depth API?

I was hoping it's possible to estimate this, e.g., by checking if their depth values are close to each other, which would indicate that they might be collapsing. Is there a way to do this easily?

I think Depth API doesn't currently support meshes for physics-based interactions, but I thought there might be an easier way to check this, since we can compute depth already.

Thank you and I look forward to hearing from you!

TudorJude commented 3 months ago

Hey there dogadogan,

There's a thread on this git, where I posted a compute shader that does this. It's a non-trivial problem, though, and it doesn't exactly do what you want.

Just checked the thread, it was actually started by you regarding Raycasting. And you're correct, Depth API does not generate any mesh, it just throws a depth texture that shaders use to determine environment depth.