Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 26 Mar 2011
Offline Last Active Nov 19 2012 07:17 PM

Topics I've Started

Collisions: should I use triangles, cubes or spheres?

12 November 2012 - 09:00 PM

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.

Meshing a roller coaster from a spline

12 May 2011 - 07:59 PM

I'm working on an open source theme park game, and need to know this. I have the bezier point function worked out:

   P(t)=pow(1-t,3)*P1  +  3*pow(1-t,2)*t*P2  +  3*(1-t)*pow(t,2)*P3  +  pow(t,3)*P4;

(I will put this into a matrix form, but used a polynomial statement for clarity.) This gives me the center point for each progression along the spline, but does not give me orientation. I was thinking of stepping the roll, pitch and yaw angles evenly from start to finish, but I still need to rotate the track vertices somehow. Eulers seem to work for most types of track elements, if I go in the progression of roll -> pitch -> yaw, but quaternions would probably be better if I had any skill using them. Another problem is overall track orientation. Since Tracks will be rotated on the y axis (yaw), I need to add a yaw value to the base yaw.

My plan was to center a cross section of track at a certain center of gravity, like the rider's heart (if there was a middle seat). I would then rotate the cross-section by the <pitch,yaw,roll> angle triple, in the order I mentioned. I would start with the first cross section and extrude to the second, and then 3rd, 4th, ... all the way up to the last for the track segment specified by the 4 Bezier control points. is this a good way, or is there a better, streamlined version out there?

I know of the heading concept < right vector, up vector, forward vector > , but am unsure how to implement it in this algorithm.

BTW, we're planning to use Irrlicht engine for this game, so I have to do it in terms of its API.