예제 #1
0
void FlightSimDemo::update()
{
    // Find the duration of the last frame in seconds
    float duration = (float)TimingData::get().lastFrameDuration * 0.001f;
    if (duration <= 0.0f) return;

    // Start with no forces or acceleration.
    aircraft.clearAccumulators();

    // Add the propeller force
    cyclone::Vector3 propulsion(-10.0f, 0, 0);
    propulsion = aircraft.getTransform().transformDirection(propulsion);
    aircraft.addForce(propulsion);

    // Add the forces acting on the aircraft.
    registry.updateForces(duration);

    // Update the aircraft's physics.
    aircraft.integrate(duration);

    // Do a very basic collision detection and response with the ground.
    cyclone::Vector3 pos = aircraft.getPosition();
    if (pos.y < 0.0f)
    {
        pos.y = 0.0f;
        aircraft.setPosition(pos);

        if (aircraft.getVelocity().y < -10.0f)
        {
            resetPlane();
        }
    }

    Application::update();
}
예제 #2
0
int32_t main(int32_t a_argc, char **a_argv)
{
  opendlv::proxy::actuator::propulsion::Propulsion propulsion(a_argc, a_argv);
  return propulsion.runModule();
}