Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2025


Ignore:
Timestamp:
Oct 28, 2008, 9:36:20 AM (15 years ago)
Author:
rgrieder
Message:

Removed something we better never mention again… ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/pawns/SpaceShip.cc

    r2024 r2025  
    107107            velocity.z = -this->maxSpeed_;
    108108
    109 #define normalize_acc_and_vel(dimension)                                 \
    110         if (this->acceleration_.dimension == 0)                          \
    111         {                                                                \
    112             if (velocity.dimension > 0)                                  \
    113             {                                                            \
    114                 velocity.dimension -= (this->translationDamping_ * dt);  \
    115                 if (velocity.dimension < 0)                              \
    116                     velocity.dimension = 0;                              \
    117             }                                                            \
    118             else if (velocity.dimension < 0)                             \
    119             {                                                            \
    120                 velocity.dimension += (this->translationDamping_ * dt);  \
    121                 if (velocity.dimension > 0)                              \
    122                     velocity.dimension = 0;                              \
    123             }                                                            \
     109        // normalize velocity and acceleration
     110        for (size_t dimension = 0; dimension < 3; ++dimension)
     111        {
     112            if (this->acceleration_[dimension] == 0)
     113            {
     114                if (velocity[dimension] > 0)
     115                {
     116                    velocity[dimension] -= (this->translationDamping_ * dt);
     117                    if (velocity[dimension] < 0)
     118                        velocity[dimension] = 0;
     119                }
     120                else if (velocity[dimension] < 0)
     121                {
     122                    velocity[dimension] += (this->translationDamping_ * dt);
     123                    if (velocity[dimension] > 0)
     124                        velocity[dimension] = 0;
     125                }
     126            }
    124127        }
    125 
    126         normalize_acc_and_vel(x)
    127         normalize_acc_and_vel(y)
    128         normalize_acc_and_vel(z)
    129128
    130129        this->setVelocity(velocity);
Note: See TracChangeset for help on using the changeset viewer.