I am involved in the development of an open source game featuring theme park construction and operation. For this game I want to make a quadtree map for collisions to prevent two solid objects from going in the same space. ( I have considered octrees, but they don't seem useful in relatively flat space. Quadtrees would be sufficient.) That part is mostly figured out, except for the core collision testing for each object in the tree. Triangles are very precise, and would correspond to the object's graphics almost exactly. The problem is that the algorithm is a little "involved" - both for me and the processor. For spheres I easily do a single-line function based off of distance-squared. Boxes, as long as they are axis-aligned, would be a simple case of comparing bounds. I've looked over a few texts explaining triangle intersection, and they involve multiple steps and a lot of linear algebra. I generally understand the math and geometry behind it, but it seems too complex for my needs.
I would like a certain degree of precision (perhaps within a third of a meter or so), but with small radii and more points in the "cloud", I could make collisions somewhat accurate with variable-radius spheres. Axis-aligned boxes would require more comparisons, but not as many as triangles would. Plus I would still need a lot of "grains" to make the map accurate. Should I go for simple computations and high memory usage, or multiple step matrix and vector processing with lower memory usage? I would like graphical collision to be close to physical collision, but not exact. The polygon counts for large roller coaster track go into the 100K+ range. The number of objects on a map will be huge. Think along the lines of RollerCoaster Tycoon or SimCity. This game aspires to something of that scale, if not bigger.
I am using Irrlicht game library for this game. I know there are some collision checks in that engine, but they seem tied to graphics scenes. I may want to make the collision geometry for certain objects (like ride track) simpler than their graphical mesh geometry. I figured a custom tree would be needed for this task. With STL dynamic structures, that should be a piece of cake. But if someone can point me to a better way, I would be glad. I don't like reinventing the wheel if I don't need to.
Any general advice on collisions in 3D would be appreciated.
RollerSimmerMember Since 26 Mar 2011
Offline Last Active May 03 2015 08:32 PM
- Group Members
- Active Posts 6
- Profile Views 1,074
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown