Sign in to follow this  

Car on terrain

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

Hi. Before we start, let me tell you that I've already googled and used the search function to find some solution to this. And as you can see, I didn't found one. Let's assume a terrain made of arbitrary number of polygons, like on this image: As you can see, the triangles aren't aligned as they would if I would be using Quads. My question is: What's the fastest/best way to test on which triangle the car's wheel lies on? I've done this with the terrain like this: And it was easy, since the position where the wheel lies can be easily calculated by dividing the current position by the distance of each quad. But I only have a slight idea of how to solve this question. The only method I came up was to use Quadtree/Octree to partition the world, test each block to see where the car's wheel lies, and then, test each triangle on the leaf against the wheel. Any other ideas?

Share this post


Link to post
Share on other sites
From my experience, the usual method of speeding up this kind of thing is to use some kind of Bounding Volume tree.

AABB trees, OBB trees, and k-DOP trees are good examples that can be used in these circumstances.

It's a big and complex area, on which I'm no expert, so I will simply recommend a good book on the subject...

Real-Time Rendering by Tomas Moller and Eric Haines : http://www.realtimerendering.com/


If you're after an off-the-shelf solution that you can just plug into your engine, then check out the open source OPCODE library : http://www.codercorner.com/Opcode.htm. Just point it at your polygons, and use it's ray test functions, and you will find it to be pretty fast.

Hope that helps.

Share this post


Link to post
Share on other sites
Thanks for the help, guys.

The terrain will be created by hand, using a modeling tool. That's why I can't assume the polygons would be aligned as they would if I used heightmaps.

I think I'm going to partition the terrain using quadtree/octree and check all polygons inside the node where the wheel is.

Meanwhile, when searching for this solution, I came across Quake III Rally, a MOD for quake 3. What got my attention is that they're using BSP trees both for culling and collision. And since I've already written a BSP viewer, I'm going to take a closer look on this, and see if this can be used for my game, too, since BSP are much more better for collision.

Thanks.

The link for Quake III Rally is:
http://www.quakerally.com/

If anyone has a better option, let me know.

Share this post


Link to post
Share on other sites

This topic is 4386 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this