Jump to content

  • Log In with Google      Sign In   
  • Create Account


Detect camera inside wall


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 larspensjo   Members   -  Reputation: 1526

Like
0Likes
Like

Posted 12 July 2012 - 08:27 AM

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.

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).

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.

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).

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.
Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

Sponsor:

#2 slicer4ever   Crossbones+   -  Reputation: 3208

Like
0Likes
Like

Posted 12 July 2012 - 08:54 AM

I personally treat a camera as just another spherical object in the scene, and allow my collision code to handle it, so that it doesn't go behind/through objects.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#3 Murdocki   Members   -  Reputation: 274

Like
0Likes
Like

Posted 12 July 2012 - 09:54 AM

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.

#4 dpadam450   Members   -  Reputation: 842

Like
1Likes
Like

Posted 13 July 2012 - 09:45 AM

This is a physics problem. You don't need to test every triangle but you can generalize things like say a statue as a box.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS