camera collision detection

Started by
2 comments, last by oliii 17 years, 4 months ago
hello, i have a camera that always looks at the main character from a certain distance and can be freely rotated around the character, but always stays at its distance. now since the character should always be visible i want to check if something is between the character and the camera position and then place the camera at the nearest intersection point of the occluder. for starters my datasturcture is very simple. the terrain is a regular grid and only whole tiles should be checked. does anyone know of a simple algorithm to accomplish this? thanks!
Advertisement
Simple sphere collision should be good enough: Check collision from the center of the sphere(where the camera is) to the planes: check the distance from the center of the sphere to the closest point on those planes. If that distance is closer than the radius of the sphere, the plane colliding/intersecting the sphere.
[www.LifeIsDigital.net - My open source projects and articles.
thanks
ok, but how do i get the planes?

as i said the collision detection so far is based on a regular grid, where each grid cell can be passable or not.
extract the triangles from each cells, and do ollision with those. Using raytrace from character's head, or a swept sphere, to find the furthest valid position.

Everything is better with Metal.

This topic is closed to new replies.

Advertisement