bounding sphere around the camera??


#1

Hi, i’m wonder how do i do collision detection between a moving spherical camera and the objects in the world. What I already have is treating camera as a point object.

Anyone has any suggestions?


#2

You could do collision detection in the way you would with other objects, possibly with a bounding sphere, but you will need to do some extra stuf for the collision response, like counter steering the camera toward the player if he goes trough a door or something.

[left]'The Full Spectrum Warrior Camera System’ article on gamasutra might give some idea’s. You will need to signup(free) on gamasutra if you haven’t already, but the site is definitely worth it.[/left]


#3

thanks Cyberdigitus!

I’ve read thru the article and it’s somewhat helpful but I guess i have a different problem here.

The problem i have is that with a sphere, where should i start doing collision detection?

I can start with the center of the sphere and hit the collision point. From theere backtrack r(the raridus) units away from that point along the direction of the normal at the point of collision. But is this the correct way to do it?


#4

I don’t know if I understand exactly what you are asking. But in order to perform collision detection between a sphere and polygons, there is a lot more work than for collision detection for a point and polygons. One way to do it is to displace each polygon along its normal by the radius of the sphere ® and then just perform a line segment to polygon test on the displaced polygon. The line segment in this case is the segment between the starting point and ending point of the point’s movement. In other words, it represents the movement of the point.

This way, when there is an intersection between the line and the polygon, it is actually r units away from the real position of the polygon, so in actuality the edge of the sphere is touching the polygon at that time. So in a way, this is doing what you asked.

However, assuming you use triangles, you will also have six special cases for each triangle. The sphere might touch an edge or a point of the triangle. If you don’t check for these special cases, your sphere can fall in ‘between’ the displaced polygons since the action of displacing them brings them apart from each other even if they were stuck together initially. The way to test the edges in this method is by handling the edges as cylinders of radius r, and the points as sphere of radius r and then performing line segment to cylinder and line segment to sphere tests.

‘Mathematics for 3D Game Programming & Computer Graphics’ by Eric Lengyel has a chapter on collision detection which describes this method. I think it’s sort of a difficult topic though, it took a while to understand it, at least for me.


#5

thanks Antimode

although i haven’t had a chance to skim through the book you mentioned yet.


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.