Quote: "you only render one subset of it at a time, and each of those subsets cans have a different position,"
Can you imagine how many subsets you would require to cover all possibilities of Gun Elevation combined with all possibilities of turret rotation.
Once one adds in something like tank track movement, then it becomes a huge job.
@ go2none,
YES a great little demo for what is going on.
Have just made the barrel a little more barrel like.
Have moved the pivot point of the barrel to its inner end.
Provided barrel motion capability.
When one moves the tank a little closer to a screen corner it is very easy to see what is going on.
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff ();
dbMaximizeWindow ();
dbPositionCamera ( 0, 50, 0 );
dbRotateCamera ( 90, 0, 0 );
// body
dbMakeObjectBox (1, 10, 5, 15);
// turret
dbMakeObjectBox (2, 5, 5, 5);
dbGlueObjectToLimb (2, 1, 0);
dbPositionObject (2, 0, 5, -3);
dbColorObject (2, dbRGB(100,100,100));
// barrel
dbMakeObjectBox (3, 2, 2, 10);
dbOffsetLimb (3, 0, 0.0, 0.0, 5.0); // move the barrel pivet point to one end *******************
dbGlueObjectToLimb (3, 2, 0);
dbPositionObject (3, 0, 2, 2); // pivet point for barrel is just inside of the turret **********************
dbColorObject (3, dbRGB(255,0,0));
dbOffsetLimb (1, 3, 3.0, 3.0, 3.0);
// our main loop
while ( LoopGDK ( ) )
{
dbText (10, 10, "WASD controls movement of the tank");
dbText (10, 25, "Q / E controls movement of the turret");
dbText (10, 40, "Z / C controls movement of the gun elevation");
if (dbKeyState(17)) { dbMoveObject (1, 0.5); } // w
if (dbKeyState(31)) { dbMoveObject (1, -0.5); } // s
if (dbKeyState(32)) { dbTurnObjectLeft (1, -1); } // a
if (dbKeyState(30)) { dbTurnObjectLeft (1, 1); } // d
if (dbKeyState(16)) { dbTurnObjectLeft (2, 1); } // q
if (dbKeyState(18)) { dbTurnObjectLeft (2, -1); } // e
if (dbKeyState(0x2C)) { dbPitchObjectUp ( 3, 1 ); } // z
if (dbKeyState(0x2E)) { dbPitchObjectUp ( 3, -1 ); } // c
// update the screen
dbSync ( );
}
// return back to windows
return;
}
If only we could get a proper 3D model, we would have the making of a great little tutorial here.