Changeset 5898 for code/branches/core5/src/modules/pong/PongBall.cc
- Timestamp:
- Oct 7, 2009, 2:02:15 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/modules/pong/PongBall.cc
r5892 r5898 46 46 47 47 this->speed_ = 0; 48 this->accelerationFactor_ = 1.0f; 48 49 this->bat_ = 0; 49 50 this->batID_ = new unsigned int[2]; … … 76 77 Vector3 position = this->getPosition(); 77 78 Vector3 velocity = this->getVelocity(); 79 Vector3 acceleration = this->getAcceleration(); 78 80 79 81 if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2) … … 102 104 velocity.x = -velocity.x; 103 105 velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_; 106 acceleration = this->bat_[1]->getVelocity() * this->accelerationFactor_ * -1; 104 107 105 108 this->fireEvent(); … … 122 125 velocity.x = -velocity.x; 123 126 velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_; 127 acceleration = this->bat_[0]->getVelocity() * this->accelerationFactor_ * -1; 124 128 125 129 this->fireEvent(); … … 137 141 } 138 142 143 if (acceleration != this->getAcceleration()) 144 this->setAcceleration(acceleration); 139 145 if (velocity != this->getVelocity()) 140 146 this->setVelocity(velocity);
Note: See TracChangeset
for help on using the changeset viewer.