Ejemplo n.º 1
0
void HapticDevice::resetThrow(){
	m_Thrown = NULL;
	m_thrownObjects = NULL;
	m_thrownRigids = NULL;
	m_caught = NULL;
	clearTrajectory();
	m_selectedDistance = Distance_max*2;
	m_freeT = false;
}
Ejemplo n.º 2
0
//Calculate the trajectory from the positon of this spaceship to the global point
void Spaceship::calculateTrajectory(sf::Vector2f globalTarget, sf::Time dt, sf::Time maxTime)
{
    sf::Vector2f target = globalTarget - getWorldPosition();
    this->target = globalTarget;
    sf::Vector2f position(0, 0);
    sf::Vector2f velocity = getVelocity();
    sf::Time accumulatedTime = sf::Time::Zero;
    clearTrajectory(); 
    trajectory->add(getWorldPosition());
    //Integrate the trajectory
    while(accumulatedTime < maxTime)
    {
        sf::Vector2f diff = target-position;
        velocity += normalize((target-position))*deltaV*dt.asSeconds();
        if(sqrt(velocity.x*velocity.x+velocity.y*velocity.y) > maxV)
            velocity = normalize(velocity)*maxV;
        position += velocity*dt.asSeconds();
        trajectory->add(getWorldPosition()+position);
        accumulatedTime += dt;
    }
}
Ejemplo n.º 3
0
void initializeTrajectory(void) {
    clearTrajectory();
}
Ejemplo n.º 4
0
void initializeTrajectory() {
    width = WHEELS_DISTANCE;
    clearTrajectory();
}