Ignore:
Timestamp:
08/25/08 08:34:10 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2860 r2864  
    221221 
    222222 
    223 void Camera::SetDirection(const Vector3 &direction) 
    224 { 
    225         Vector3 h1 = direction; h1.z = 0;  
    226          
    227         if (SqrMagnitude(h1) > 0) 
    228         { 
    229                 h1.Normalize(); 
    230                 mPitch = acos(DotProd(h1, Vector3(0, 1, 0))); 
    231         } 
    232  
    233         Vector3 h2 = direction;  
    234          
    235         if (SqrMagnitude(h2) > 0) 
    236         { 
    237                 h2.Normalize(); 
    238                 mYaw = -acos(DotProd(h2, h1)); 
    239         } 
     223void Camera::SetDirection(const Vector3 &dir) 
     224{ 
     225        Normalize(dir); 
     226 
     227        mPitch = atan2(dir.x, dir.z); 
     228        mYaw = atan2(dir.y, sqrt((dir.x * dir.x) + (dir.z * dir.z))); 
    240229 
    241230        CalculateFromPitchAndYaw(); 
Note: See TracChangeset for help on using the changeset viewer.