![]() |
![]() |
|
This RenderWare 3.1 demo features a simple game of Yahtzee that (a) uses rigid-body dynamics to simulate how the dice move and respond to collisions, and (b) uses the RenderWare 3D graphics API to setup and render the geometry and lighting contained in the game. More importantly, RenderWare is used as our first line of attack for detecting collisions between the dice and the dice table, and between the dice themselves. The dice table geometry is contained in a BSP structure specifically aimed at very fast collision detection with other (non-BSP) objects moving in the world defined by the BSP. Also, because objects are tied to the world by location, it is very simple and efficient to perform collision detection between these moving objects. In this demo, RenderWare’s intersection schemes are used as a first-level, coarse-grained collision detection process. For collisions between the dice and the table, this amounts to finding intersections of the dice bounding-spheres with the table triangles. When an intersection is found, a second-level (application-specific) test is performed that determines if any of the die’s vertices are in collision with the supplied collision triangle or triangles. Similarly, for collisions between the dice, bounding-sphere tests are performed, but the process stops there and a collision response is calculated that assumes the colliding bodies act like hard spheres. Try it out yourself |