[Solved]Camera following a path without falling off the edge
Posted: Sat Jul 03, 2010 12:19 am
I made a mesh which represents a road network from GPS points and would like to have a FPS type camera traverse the road network without falling off the road (leaving the road, going over the edge), and can turn left/right into streets etc. The road is suspended in space, i.e. there is no adjacent terrain, just the road.
What would be the best approach? How can I test that I am still on the road? Can one search for a vertice close to the camera position? I looked at the TriangleSelector but can't see how I can use that to stop falling off the road as there would be no triangles to select.
I want to be able to steer the vehicle (i.e. not have a predetermined fix path).
I looked at Tutorial 7 sample code using collision detection, which is close to what I want, but I don't have vertical side(s) to collide against, unless I add sidewalk(s) to both sides of the road and have the road depressed and can then test for collision with the sidewalk. Is this the only way to solve the problem?
Any ideas/pointers/advice would be appreciated.
Thanks
Willem
What would be the best approach? How can I test that I am still on the road? Can one search for a vertice close to the camera position? I looked at the TriangleSelector but can't see how I can use that to stop falling off the road as there would be no triangles to select.
I want to be able to steer the vehicle (i.e. not have a predetermined fix path).
I looked at Tutorial 7 sample code using collision detection, which is close to what I want, but I don't have vertical side(s) to collide against, unless I add sidewalk(s) to both sides of the road and have the road depressed and can then test for collision with the sidewalk. Is this the only way to solve the problem?
Any ideas/pointers/advice would be appreciated.
Thanks
Willem