Projectile::Projectile(float px, float py, float pDirection, float pVelocity, float pDamage, sf::Texture mSpriteTexture) { CalculateVelocities(pDirection, pVelocity); SetDamage(pDamage); SetTexture(mSpriteTexture); SetDirection(pDirection); SetPosX(px); SetPosY(py); }
void LineSmoother::ProcessNewPoint() { if(_orgPoints.size() < 1) { // Nothing to do. return; } uint32 newPointIndex = _orgPoints.size()-1; #ifdef DEBUG_LINE_SMOOTHER _orgPoints[newPointIndex].widthPixels = 1.0*newPointIndex; #endif CalculateVelocities(newPointIndex); CalculateWidths(newPointIndex); CalculateSmoothPoints(newPointIndex); }
// Update the controller void ServoPlugin::Update() { // handle callbacks queue_.callAvailable(); common::Time stepTime; stepTime = world->GetSimTime() - prevUpdateTime; if (controlPeriod == 0.0 || stepTime > controlPeriod) { CalculateVelocities(); publish_joint_states(); prevUpdateTime = world->GetSimTime(); } if (enableMotors) { servo[FIRST].joint->SetVelocity(0, servo[FIRST].velocity); if (countOfServos > 1) { servo[SECOND].joint->SetVelocity(0, servo[SECOND].velocity); if (countOfServos > 2) { servo[THIRD].joint->SetVelocity(0, servo[THIRD].velocity); } } servo[FIRST].joint->SetMaxForce(0, maximumTorque); if (countOfServos > 1) { servo[SECOND].joint->SetMaxForce(0, maximumTorque); if (countOfServos > 2) { servo[THIRD].joint->SetMaxForce(0, maximumTorque); } } } else { servo[FIRST].joint->SetMaxForce(0, 0.0); if (countOfServos > 1) { servo[SECOND].joint->SetMaxForce(0, 0.0); if (countOfServos > 2) { servo[THIRD].joint->SetMaxForce(0, 0.0); } } } }