Пример #1
0
void Foam::sixDoFSolvers::CrankNicolson::solve
(
    bool firstIter,
    const vector& fGlobal,
    const vector& tauGlobal,
    scalar deltaT,
    scalar deltaT0
)
{
    // Update the linear acceleration and torque
    updateAcceleration(fGlobal, tauGlobal);

    // Correct linear velocity
    v() = tConstraints()
      & (v0() + aDamp()*deltaT*(aoc_*a() + (1 - aoc_)*a0()));

    // Correct angular momentum
    pi() = rConstraints()
      & (pi0() + aDamp()*deltaT*(aoc_*tau() + (1 - aoc_)*tau0()));

    // Correct position
    centreOfRotation() =
        centreOfRotation0() + deltaT*(voc_*v() + (1 - voc_)*v0());

    // Correct orientation
    Tuple2<tensor, vector> Qpi =
        rotate(Q0(), (voc_*pi() + (1 - voc_)*pi0()), deltaT);
    Q() = Qpi.first();
}
void
ManualSmoothingZ::smoothVelFromSticks(float &vel_sp, const float dt)
{
	updateAcceleration(vel_sp, dt);
	velocitySlewRate(vel_sp, dt);
	_vel_sp_prev = vel_sp;
}
Пример #3
0
void PointMass::update_ddq()
{
  // ddq = imp_psi*(alpha - m*(dw(parent) x mX + dv(parent))
  Eigen::Vector3d ddq =
      mImplicitPsi
      * (mAlpha - mMass
         * (mParentSoftBodyNode->getBodyAcceleration().head<3>().cross(mX)
            + mParentSoftBodyNode->getBodyAcceleration().tail<3>()));
  setGenAccs(ddq);
  assert(!math::isNan(ddq));

  // Update dv
  updateAcceleration();
}
Пример #4
0
void Foam::sixDoFSolvers::Newmark::solve
(
    bool firstIter,
    const vector& fGlobal,
    const vector& tauGlobal,
    scalar deltaT,
    scalar deltaT0
)
{
    // Update the linear acceleration and torque
    updateAcceleration(fGlobal, tauGlobal);

    // Correct linear velocity
    v() =
        tConstraints()
      & (v0() + aDamp()*deltaT*(gamma_*a() + (1 - gamma_)*a0()));

    // Correct angular momentum
    pi() =
        rConstraints()
      & (pi0() + aDamp()*deltaT*(gamma_*tau() + (1 - gamma_)*tau0()));

    // Correct position
    centreOfRotation() =
        centreOfRotation0()
      + (
            tConstraints()
          & (
                deltaT*v0()
              + aDamp()*sqr(deltaT)*(beta_*a() + (0.5 - beta_)*a0())
            )
        );

    // Correct orientation
    vector piDeltaT =
        rConstraints()
      & (
            deltaT*pi0()
          + aDamp()*sqr(deltaT)*(beta_*tau() + (0.5 - beta_)*tau0())
        );
    Tuple2<tensor, vector> Qpi = rotate(Q0(), piDeltaT, 1);
    Q() = Qpi.first();
}
Пример #5
0
void BodyNode::update_ddq() {
  if (mParentJoint->getNumGenCoords() == 0)
    return;

  Eigen::VectorXd ddq;
  if (mParentBodyNode) {
    ddq.noalias() =
        mImplicitPsi * (mAlpha - mImplicitAI_S.transpose() *
                        math::AdInvT(mParentJoint->getLocalTransform(),
                                     mParentBodyNode->getBodyAcceleration()));
  } else {
    ddq.noalias() = mImplicitPsi * mAlpha;
  }

  mParentJoint->GenCoordSystem::setGenAccs(ddq);
  assert(!math::isNan(ddq));

  updateAcceleration();
}
Пример #6
0
void Player::update(float deltaTime)
{

    if(mIsAlive)
    {
        updateAcceleration();
        updateAnimation(deltaTime);
        settledPosition(deltaTime);
        collosion();

        if(mShieldTime <= 0)
        {
            tryShot(deltaTime);
        }else
        {
            mShieldTime -= deltaTime;
        }
    }


    if(!mIsAlive)
    {
        if(!mAnimationManager.isPlaying())
        {
            mAnimationManager.reset();
            mAnimationManager.setAnimation(AnimationID::PlayerAnimationStay);
            mAnimationManager.play();
            mShieldTime = mMaxShieldTime;
            reborn();
        }
        updateAnimation(deltaTime);
        collosion();
    }


}
//normal update call
void CloudsVisualSystemFlocking::selfUpdate(){
    if(bUpdateAcc) updateAcceleration();
    if(bUpdateVel) updateVelocity();
    if(bUpdatePos) updatePosition();
}
Пример #8
0
void ElysiumEngine::RigidBody::updateAndIntegrate(float dt)
{
    updateAcceleration();
    integrateVelocity(dt);
}