how do i use the sparkys ray cast... could you help me.. is there any sample code using in the sample terrain tutorial included in the GDK?? i jz want to know how to use it for my flight simulator for collision and for grading the user...
another question:
how can i display a text or image if my object's Y position or the altitude is decreasing and going near to the terrain.. thankz to ol dat'll replay...
oh by the way heres my code for the while(LOOP)
while ( LoopGDK ( ) )
{
// let the user move the camera around with the arrow keys
// dbControlCameraUsingArrowKeys ( 0, 2.0f, 2.0f );
// find the ground height of the terrain
float fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
// create a rotation axis based on Key Press
if (dbUpKey()==1)
{
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbUpKey ( ) * 0.4f );
}
fCameraAngleX = dbWrapValue ( fCameraAngleX - dbDownKey ( ) * 0.4f);
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbRightKey ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY - dbLeftKey ( ) * 0.4f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
// W state
if (dbKeyState(17))
{
dbRotateObject(5,(fCameraAngleX),(fCameraAngleY),dbObjectPositionZ(5));
dbPositionObject( 5, dbNewXValue( dbObjectPositionX( 5 ), dbObjectAngleY( 5 ), 10 ), dbNewYValue( dbObjectPositionY( 5 ), dbObjectAngleX( 5 ), 10), dbNewZValue( dbObjectPositionZ( 5 ), dbObjectAngleY( 5 ), 10 ));
}
// reposition the camera so it is directly above the ground
dbPositionCamera ( dbObjectPositionX (5),dbObjectPositionY (5), dbObjectPositionZ (5)-10.0f);
// update the terrain
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}