For those that want to fly under the bridges

/// scenery.cxx

int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {

    sgdVec3 sc;

    sgdSetVec3( sc, center[0], center[1], center[2]);

    // overridden with actual values if a terrain intersection is
    // found
    double hit_elev = -9999.0;
    double hit_radius = 0.0;
    sgdVec3 hit_normal = { 0.0, 0.0, 0.0 };
    
    bool hit = false;
    if ( fabs(sc[0]) > 1.0 || fabs(sc[1]) > 1.0 || fabs(sc[2]) > 1.0 ) {
        // scenery center has been properly defined so any hit should
        // be valid (and not just luck)
        hit = fgCurrentElev(abs_pos_vector,
                            sc,
    // uncomment next paramater to fly under
    // bridges and a slightly faster algorithm
    // but you won't be able to land on aircraft carriers
                                    current_tile->get_terra_transform(),
                                &hit_list,
                                    &hit_elev,
                                    &hit_radius,
                                    hit_normal);
    }

    if ( hit ) {
        // cout << "elev = " << hit_elev << " " << hit_radius << endl;
        globals->get_scenery()->set_cur_elev( hit_elev );
        globals->get_scenery()->set_cur_radius( hit_radius );
        globals->get_scenery()->set_cur_normal( hit_normal );
    } else {
        globals->get_scenery()->set_cur_elev( -9999.0 );
        globals->get_scenery()->set_cur_radius( 0.0 );
        globals->get_scenery()->set_cur_normal( hit_normal );
    }
    return hit;
}


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to