void Player::Update(float deltaTime, int worldWidth, int worldHeight) { float speed = fabs(sqrtf(m_velocity.x * m_velocity.x + m_velocity.y * m_velocity.y)); if (speed > MAX_VELOCITY) { m_velocity.x = (m_velocity.x / speed) * MAX_VELOCITY; m_velocity.y = (m_velocity.y / speed) * MAX_VELOCITY; } m_currentSpeed = speed; ApplyDrag(); Entity::Update(deltaTime, worldWidth, worldHeight); }
void SpringSys::Compute_Forces(TimeValue t, int index) { ApplyDrag(index); ApplyUnaryForces(t, index); ApplySpring(t, index); }