For some reason that I dont understand my code rotes the object using the wheel on the mouse but only in one direction. colonel x only rotates clockwise , heres the relevant snippet.
float Turnangle= dbWrapValue(0);
while ( LoopGDK ( ) ) ///////////////////////////////////////////loop gdk
{
fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ),dbCameraPositionZ ( ));
oheight = dbGetTerrainGroundHeight (1, dbObjectPositionX (11 ), dbObjectPositionZ(11)); /////////character height
float fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.35f );
float fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.35f ); ///camera movement settings
if (dbKeyState (17)==1) ////////////w//////////////////////////////keystate walk
dbMoveObject (11,-28.0f);
if (dbKeyState (31)==1) //w////////////////////////////////////////Keystate walk reverse
dbMoveObject (11, 28.0f);
if (dbKeyState (30)==1) //a////////////////////////////////////////Keystate walk left
dbMoveObjectLeft (11,-11.0f);
if (dbKeyState (32)==1) //d////////////////////////////////////////Keystate walk right
dbMoveObjectRight (11,-11.0f);
if (dbKeyState (18)==1) //e////////////////////////////////////////Keystate jump
{
dbMoveObjectUp (11, 33.0f); dbWait (8); dbMoveObject (11, -10.0f);
dbMoveObjectUp (11, 33.0f); dbWait (10); dbMoveObjectDown(11, 33.0f); dbWait (8);/////////jump code
dbMoveObject (11, -10.0f); dbMoveObjectDown(11, 33.0f); dbMoveObject (11, -10.0f);
}
dbSync ( );
dbPositionObject (11, dbObjectPositionX (11 ) ,oheight, dbObjectPositionZ(11));/// ensure object is on the ground
dbControlCameraUsingArrowKeys (0,10.0f,10.0f ); ///moves camera about
dbSetObjectToCameraOrientation ( 11 ); //make sure colonel x is facing the camera
dbRotateObject (11, 0, 180, 0); ///////turn colonel x 180 degrees so he is facing away
if (dbMouseMoveZ() < 0) //negative mouse movement
Turnangle += 25;
if (dbMouseMoveZ() > 0)
Turnangle -= 25;
dbRotateObject (11, 0,Turnangle, 0);// add wrapvalue to new yvalue?
dbUpdateTerrain ( );
dbSync ( );
thanks for your help!
If you're not livin', you're already dead!