Jump to content
  • Advertisement
Sign in to follow this  
ehmdjii

camera collision detection

This topic is 4234 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

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!