Ignore:
Timestamp:
11/06/08 15:14:49 (16 years ago)
Author:
mattausch
Message:

now strafing up not working anymore!!!!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3103 r3105  
    175175bool descendKeyPressed = false; 
    176176bool ascendKeyPressed = false; 
     177bool leftStrafeKeyPressed = false; 
     178bool rightStrafeKeyPressed = false; 
     179 
    177180bool altKeyPressed = false; 
    178181 
     
    844847 
    845848 
     849void KeyStrafe(float shift) 
     850{ 
     851        Vector3 viewDir = camera->GetDirection(); 
     852        Vector3 pos = camera->GetPosition(); 
     853 
     854        // the 90 degree rotated view vector  
     855        // z zero so we don't move in the vertical 
     856        Vector3 rVec(viewDir[0], viewDir[1], 0); 
     857 
     858        Matrix4x4 rot = RotationZMatrix(M_PI * 0.5f); 
     859        rVec = rot * rVec; 
     860        pos += rVec * shift; 
     861 
     862        camera->SetPosition(pos); 
     863} 
     864 
     865 
    846866/** Initialize the deferred rendering pass. 
    847867*/ 
     
    899919        if (descendKeyPressed) 
    900920                KeyVerticalMotion(-KeyShift()); 
     921        if (leftStrafeKeyPressed) 
     922                KeyStrafe(KeyShift()); 
     923        if (rightStrafeKeyPressed) 
     924                KeyStrafe(-KeyShift()); 
     925 
    901926 
    902927        // place view on ground 
     
    12181243                downKeyPressed = true; 
    12191244                break; 
     1245        case 'j': 
     1246        case 'J': 
     1247                leftStrafeKeyPressed = true; 
     1248                break; 
     1249        case 'k': 
     1250        case 'K': 
     1251                rightStrafeKeyPressed = true; 
     1252                break; 
    12201253        case 'r': 
    12211254        case 'R': 
     
    12971330                ascendKeyPressed = false; 
    12981331                break; 
    1299          
     1332        case 'j': 
     1333        case 'J': 
     1334                leftStrafeKeyPressed = false; 
     1335                break; 
     1336        case 'k': 
     1337        case 'K': 
     1338                rightStrafeKeyPressed = false; 
     1339                break; 
    13001340        default: 
    13011341                return; 
     
    15051545 
    15061546 
    1507 // strafe 
     1547/** strafe 
     1548*/ 
    15081549void MiddleMotion(int x, int y)  
    15091550{ 
Note: See TracChangeset for help on using the changeset viewer.