Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10731 in orxonox.OLD for branches/presentation


Ignore:
Timestamp:
Jun 20, 2007, 2:00:44 PM (17 years ago)
Author:
snellen
Message:

mouse can now be moved only within a restricted area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/space_ships/space_ship.cc

    r10730 r10731  
    588588    this->xMouse += event.xRel;
    589589    this->yMouse += event.yRel;
    590 //     printf("Mouse Coord: %f, %f\n", this->xMouse, this->yMouse);
     590  //  printf("Mouse Coord: %f, %f\n", this->xMouse, this->yMouse);
     591   
     592    float maxMouseDist = 75.1;
     593    #define sqr(a) ((a)*(a))
     594    float mouseDist = sqrt( sqr(0.6*xMouse) + sqr(yMouse) );
     595
     596    if ( mouseDist > maxMouseDist )
     597    {
     598        xMouse /= mouseDist/maxMouseDist;
     599        yMouse /= mouseDist/maxMouseDist;
     600    }
     601
    591602    this->weaponMan.getFixedTarget()->setRelCoor(100000, -100 * this->mouseSensitivity * yMouse, 100 * this->mouseSensitivity * xMouse);
    592603    this->secWeaponMan.getFixedTarget()->setRelCoor(50000, -50 * this->mouseSensitivity * yMouse, 50 * this->mouseSensitivity * xMouse);
Note: See TracChangeset for help on using the changeset viewer.