camera collision

Started by manji, October 04, 2010, 00:25:39

Previous topic - Next topic

manji

I am making a 3rd person platform game, and I have a problem checking for collisions of the camera inside objects. I have thought of two ways to solve this.
One way is to interpret the local coordinates to world coordinates, and check if they are inside the the objects of the scene. I have some issues here so I wanted to try something else.
The other way is through picking. Render(for selection) a rectangle of the whole window, place it a little in front, and check if there is any object that is closer to the eye than this rectangle. Although I believe I have implemented this right, it does not work. It does detect collision when objects are very close to the viewport, but not when they actually intersect it.
Any thoughts or ideas on these solutions?
toyWars game blog: http://toywars.wordpress.com/

ryanm

I wouldn't recommend using picking for this kind of thing - it's not what its designed for and picking support generally isn't great.
Your first solution is the way to go: you know where the objects in the scene are, you know where your camera is -> you can test for intersection.

manji

OK thanx. But I think I will have to use picking anyway, because I must also check if an object hides my character. So I though that maybe I could use it also for collision. I will work more on the first way.
toyWars game blog: http://toywars.wordpress.com/

basil

i think the picking-way will fail if you run backwards.