• Advertisement
Sign in to follow this  

Detect camera inside wall

This topic is 2016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3]What are the options on how to do this (kind of collision detection)? The current algorithm detects most of the cases, but there are some tricky ones that remains.[/size][/font]

[font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3]I have an application with "lots" of triangles. It is not only a problem with the camera getting inside the wall, it is a problem when getting too near the wall (passing the near frustum plane).[/size][/font]

[font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3]I suppose I can do the test "manually". That is, search through all relevant triangles and test them. This is difficult to do efficiently, as I have problems to reduce the number of possible triangles.[/size][/font]

[font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3]Another option could be to do it in the vertex shader or fragment shader. I am not sure if it is feasible, as the camera would almost certainly be behind some wall all the time (that is, facing a negative normal).[/size][/font]

[font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=3]One idea I have is to draw some dark grey walls behind the usual walls. A wall doesn't look good anyway, if you are very close to it.[/size][/font]

Share this post


Link to post
Share on other sites
Advertisement
You could shoot some rays from the current camera position to the four corners of the near clip plane. When doing this without culling back face ray tests you can check to see if the intersection distance is shorter than the distance it should have from camera origin to near clip plane point. If this is the case you know one of the corners is behind a wall. This wont work if the intersection is only in the center ofcourse.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement