removed useless _ folders

This commit is contained in:
Fred Beckhusen
2015-08-09 16:54:31 -05:00
parent fde850293c
commit 948a44dfba
5204 changed files with 2425579 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<Solution name="A_flight_script_with_more_realistic">
<Project name="A_flight_script_with_more_realistic" path="A_flight_script_with_more_realistic\A_flight_script_with_more_realistic.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,8 @@
<Project name="A_flight_script_with_more_realistic" guid="D89D5281-6C00-1014-B904-200204C60A89">
<Object name="Object" guid="D89D5379-6C00-1014-B904-200204C60A89">
<Script name="A_flight_script_with_more_realistic_1.lsl" guid="D89DF857-6C00-1014-B904-200204C60A89">
</Script>
<Script name="A_flight_script_with_more_realistic_2.lsl" guid="D89E1CDA-6C00-1014-B904-200204C60A89">
</Script>
</Object>
</Project>

View File

@@ -0,0 +1,596 @@
// :CATEGORY:Vehicles
// :NAME:A_flight_script_with_more_realistic
// :AUTHOR:Fritz Kakapo
// :CREATED:2010-12-28 21:16:02.003
// :EDITED:2013-09-18 15:38:46
// :ID:8
// :NUM:12
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// My more elaborate airplane and bird scripts are also available free in world, but I suggest that this is the place to start. This scrpt is public domain "Copyleft!". My others are distributed under GNU Free Public Licenses, so only the ideas and short sections of script should be used in proprietary flight scripts, not long sections verbatim. Direct derivatives of the others should remain open source.
//
// I am anxious for others to use my new methods. I realize that most sl residents don't have strong backgrounds in physical analysis and modeling, numerical methods and real time programming, so I have tried to make this a script that others will be able to use as a starting place and adapt to their own requirements. One can look at the other scripts when ready to add more details and features.
// :CODE:
//====================================================================================================================================
// PIETENPOL AIR CAMPER FLIGHT SCRIPT MK1, with F. t. C.'s extensive changes
//
// Portions of this script are influenced by or based on work from Alex Linden, Cubey Terra, Eoin Widget, Kerian Bunin, Ronald Krugman
// Script by Ezekiel Bailly 2005-2008
// New, more physical, flight behavior and other changes by Fritz t. Cat (Fritz Kakapo), April--May 2010.
// Copyleft!
//--------------------------------------------------------------------------------------------------------------------------------------
// Some of Fritz's changes:
// Making it act like an airplane, maybe even like a Model A engined Air Camper,
// but keeping it simple and as compatible as I can with what other sl flight scripters are doing.
// Explaining how this new script relates to the simplified physics of airplanes.
// Separated aileron and rudder controls. (The variables controlling the prim angles were already separate.)
// Some improvements in response time.
// Pulling loose wires. When I was a student, they used to send me up to trace signal cables and remove them if open.
// Trying to make it easier for the next person (or robot?) who works on it.
// Took out HUD control, for simplicity and efficiency. (Each listen puts a lot of load on the server, or used to at least.)
// More concise, clearer and more efficient code. Tables of if statements could be replaced by formulas, for example.
// Formatting. I prefer less blank lines, dashes instead. More consistent and standard indenting.
// Deleting long obsolete comments, better variable names.
//
// Wikipedia says stall speed 35 mph, top 100 mph, rate of climb 500 ft/min (152 m/min).
// It lists the Model as as 40 horsepower (30 kW), and the Camper loaded weight as 995 lb (452 kg).
// Because of sl limitattions, I have modeled that at half speed.
// The stall here is not realistic and is too slow, to keep it easy to fly and simple.
// Too slow can be fixed by increasing LINEAR_FRICTION_TIMESCALE.z to decrease lift.
// The stall is too gentle because of the approximation that the lift is proportional to the angle of incidence
// times the square of the speed, which breaks down in a stall because of boundary layer separation.
// It would be somewhat improved by making the linear friction increase (LINEAR_FRICTION_TIMESCALE decrease) with speed,
// but this is a simple script, and it is easier to fly without that.
//
// Come the revolution, there'll be no more flying level, just the same, with the wings vertical!
// Come the revolution, airplanes will turn toward the low wing, even when up side down!
//======================================================================================================================================
//
//
// *AC control flags that we set later (It won't do logic in the initialization of variables.)
integer gAngularControls;
// *AC we may keep track of angular history for more responsive turns
integer gOldAngularLevel;
// Landing Gear Weight on Wheels-Collision Integer
integer onground = TRUE;
// THROTTLE (SPEED) Sensitive Declarations
// Thrust variables:
// thrust = forward * thrust_multiplier
// Edit the maxThrottle and thrustMultiplier to determine max speed.
integer forward = 0; // this changes when pilot uses throttle controls
integer maxThrottle = 5; // Number of "clicks" in throttle control. Arbitrary, really.
float thrustMultiplier = 11.; // Amount thrust increases per click.
//
// Lift and speed
//float cruiseSpeed = 19.0; // knots, speed at which plane achieves full lift, knots!
float speed = 0.; // speed in m/s
float requested_timer_interval = 0.5; // timer call requested rate, it can be much slower
integer sit = FALSE; // pilot sitting
integer ignition = FALSE; // engine running, object physical
//
// Control Surface Motion Declarations
string last_aileron_direction;
string cur_aileron_direction;
//
string last_elevator_direction;
string cur_elevator_direction;
string last_rudder_direction;
string cur_rudder_direction;
//
// CAMERA DECLARATIONS
list drive_cam =
[
CAMERA_ACTIVE, TRUE,
CAMERA_BEHINDNESS_ANGLE, 0.0,
CAMERA_BEHINDNESS_LAG, 0.6,
CAMERA_DISTANCE, 10.0,//3.0,
CAMERA_PITCH, 10.0,
// CAMERA_FOCUS,
CAMERA_FOCUS_LAG, 0.05,
CAMERA_FOCUS_LOCKED, FALSE,
CAMERA_FOCUS_THRESHOLD, 0.0,
// CAMERA_POSITION,
CAMERA_POSITION_LAG, 0.3,
CAMERA_POSITION_LOCKED, FALSE,
CAMERA_POSITION_THRESHOLD, 0.0,
//
CAMERA_FOCUS_OFFSET,<0,0,1>//<0,0,1>
];
integer camon = FALSE;
integer camPermed;
//
key pilot = NULL_KEY;
vector angular_motor; //
vector global_vel; // velocity in the sim coordinate system
vector local_vel; // velocity in the coordinate system pointed as the airplane
integer thrustPercent = 0;
float ANGULAR_MOTOR_TIMESCALE_0 = 4.; // strength of angular motor and angular damping
float VERTICAL_ATTRACTION_TIMESCALE_0 = 17.;
//--------------------------------------------------------------------------------------------------------------------------
integer HUDon = TRUE; //"Heads Up Display" variables
string HUDtext = "";
vector HUDcolor;
//==========================================================================================================================
//
init()
{
llListen(0, "", llGetOwner(), "" );
//
llSetCameraEyeOffset( < -12, 0., 3.5 > ); // Position of camera, relative to parent.
llSetCameraAtOffset( <0, 0, 1.9 > ); // Point to look at, relative to parent.
//
llSetSitText( "AirCamper" ); // Text that appears in pie menu when you sit
//
llCollisionSound( "", 0.0 ); // Remove the annoying thump sound from collisions
//
//SET VEHICLE PARAMETERS -- See www.secondlife.com/badgeo for an explanation
llSetVehicleType( VEHICLE_TYPE_AIRPLANE );
//
// angular deflection, fin and rudder
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.3 );
llSetVehicleFloatParam( VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 1.0 );
//
// linear deflection
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0. ); // fuselage lift, both pitch and yaw cause lift
llSetVehicleFloatParam( VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 1000. ); // but we use LINEAR_FRICTION instead.
//
// angular friction
llSetVehicleVectorParam( VEHICLE_ANGULAR_FRICTION_TIMESCALE, < 1.5, 3., 6. > ); // Caused by drag of extremities.
//
// linear friction
llSetVehicleVectorParam( VEHICLE_LINEAR_FRICTION_TIMESCALE, < 37., 9., 0.15 > );
// This is the all-important trick to get the physics engine to handle the wing lift.
// The x and y components contribute to parasite drag and to fuselage lift.
// I have a note card explaining how the dependence of both lift and drag on pitch angle
// are accurately and efficiently modeled by this parameter.
// (To get a realistic depenence of lift and drag on speed, this parameter should decrease with speed.)
//
llSetVehicleVectorParam( VEHICLE_LINEAR_MOTOR_DIRECTION, <0, 0, 0> ); // Start with the Model A off.
//
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_TIMESCALE, 24. ); // loose control to feel like air
llSetVehicleFloatParam( VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 10. ); // 20 times the timer interval.
// If this is too long, it gets lost between sims more often. If it is too short, it falls in busy sims.
//
// angular motor
llSetVehicleVectorParam( VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 0, 0> ); // control surfaces
//
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_TIMESCALE, ANGULAR_MOTOR_TIMESCALE_0/5. ); // strength of " and angular damping
//
llSetVehicleFloatParam( VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 3. ); // can be refreshed in timer or not
//
// hover
llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0. ); // useful for sea planes
llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0. ); // or for taking off from bare ground
llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 1000. );
//
// vertical attractor
// This tends to keep the airplane right side up.
// More technically, it gives it dynamic stability against spiral dive.
// In rl airplanes, this stability is provided largely by dihedral and by
// the vertical distance between the aerodynamic center and the center of gravity.
// This vertical attractor is less realistic but simpler than the dihedral approximation I use in Li'l Stinker.
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.1 );
llSetVehicleFloatParam( VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, VERTICAL_ATTRACTION_TIMESCALE_0 );
// The /10. is to fix leaning over on ground, probably caused by the lack of a good sit animation.
//
// banking I don't know much what this does yet, so I am not using it.
// Used in a straightforward way, it is partly responsible for the
// un-airplanelike behavior of other sl airplanes.
// It was obviously not introduced with airplanes in mind (at least not in a rational mind).
// (I tried reversing it when up side down, but did not understand the result.)
llSetVehicleFloatParam( VEHICLE_BANKING_EFFICIENCY, 0. );
llSetVehicleFloatParam( VEHICLE_BANKING_TIMESCALE, 1000. );
//
// Falls half as fast, as though the space and speed were twice as big,
// to deal with the small size of sims and the slowness of handoffs between sims.
llSetVehicleFloatParam( VEHICLE_BUOYANCY, 0.5 ); // This and must be a constant (for any flight mode).
//
// default rotation of local frame
llSetVehicleRotationParam( VEHICLE_REFERENCE_FRAME, <0,0,0,1> ); // A noop, I think.
//
// remove these flags
llRemoveVehicleFlags( VEHICLE_FLAG_NO_DEFLECTION_UP
| VEHICLE_FLAG_HOVER_WATER_ONLY
| VEHICLE_FLAG_HOVER_TERRAIN_ONLY
| VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT
| VEHICLE_FLAG_HOVER_UP_ONLY
| VEHICLE_FLAG_LIMIT_MOTOR_UP
| VEHICLE_FLAG_CAMERA_DECOUPLED);
//-----------------------------------------------------------------------------------------------------------------
//
gAngularControls = CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_BACK | CONTROL_FWD;
//
refreshHUD();
//
llSay(0, "Cogito ergo sum." ); // "I think therefore I am.", Descartes. Variant on "Hello world!"
//
} // End init.
//
//-----------------------------------------------------------------------------------------------------------------------------------
//
refreshHUD() // from the VICE test airplane
{
if ( !sit )
{
HUDtext="Take a copy, or buy for l$ 0. \n Full permissions,
Revolutionary flight script.
Public domain, no restrictions on use.
Open the airplane as a box to get the documentation.";
HUDcolor = < 0.2, 0.4, 1. >;
jump GOTO;
}
//
if ( !HUDon )
{
HUDtext="";
jump GOTO;
}
//
HUDtext = "Airpeed: " + (string)llFloor( (local_vel.x + 0.5) ) + " m/s"
+ " = "+(string)llFloor( ( local_vel.x*1.94 + 0.5 ) ) + " kts."
+ " = "+(string)llFloor( ( local_vel.x * 100./2.54/12./5280. *60.*60. + 0.5 ) ) + " mi./hr."
+ "\n " +" = "+(string)llFloor( local_vel.x *100. /2.54/12. /5280. *60.*60. * 2. + 0.5 ) + " scaled mi./hr."
+ "\n Rate of climb: " + " = " +
(string)( llFloor( global_vel.z *100. /2.54 /12. *60. * 2. /10. + 0.5 ) * 10 ) + " scaled foot/min."
+ "\n " +
"Throttle: " + (string)thrustPercent + "%";
//
HUDcolor = < 1.0, 1.0, 1.0 >; // white when combat is disabled
//
@GOTO;
//
llSetText( "", HUDcolor, 1.0);
//llSetText(HUDtext+"\n \n \n \n \n \n \n ", HUDcolor, 1.0);
//
llMessageLinked( 2, 333, (string)HUDcolor, NULL_KEY );
llMessageLinked( 2, 137, HUDtext+"\n \n \n ", NULL_KEY );
//
} // End refreshHUD().
//
//-----------------------------------------------------------------------------------------------------------------------------------
//
default
{
state_entry()
{
init();
}
//
//----------------------------------------------------------------------------------------------------------------------
on_rez(integer num)
{
llOwnerSay("Welcome to the Pietenpol Air Camper, type 'help' for the manual.");
llOwnerSay("These controls can be typed in chat:");
llOwnerSay("Start, stop the engine: 'contact' , 'cutoff' ");
//llOwnerSay("Seat position: 'seatup' 'seatdown' (You will need to Re-sit) ");
llOwnerSay("'smoke' turns colored smoke off and on.");
//
llOwnerSay(" ");
llOwnerSay( "The arrow keys or a, d work the ailerons.");
llOwnerSay( "Shift arrow or shift a, d controls the rudder." );
llOwnerSay( "Up, down arrow or s, w controls the elevator, as usual." );
llOwnerSay( "Page up, down or e, c changes the throttle, as usual." );
llOwnerSay( "For a good turn, start the turn with the ailerons, then continue it with the rudder and elevator." );
llOwnerSay( "But the elevator and ailerons don't work at the same time as the rudder, sorry." );
llOwnerSay( "Use full throttle for take off." );
//
init();
}
//
// DETECT AV SITTING/UNSITTING AND TAKE CONTROLS
//-----------------------------------------------------------------------------------------------------------------------------------
changed( integer change )
{
//
if ( change & CHANGED_LINK )
{
pilot = llAvatarOnSitTarget();
//
if ( pilot )
{
if ( pilot != llGetOwner() )
//if ( FALSE )
{
// only the owner can use this vehicle
llWhisper(0,
"Please take a copy of this airplane and fly your own copy.
(If it is not set \"free to copy\" or \"for sale 0 l$\" contact the owner or the creator.)
You aren't the owner -- only the owner can fly this plane.");
llUnSit( pilot );
//llPushObject(pilot, <0,0,10>, ZERO_VECTOR, FALSE);
}
else
{ // Pilot sits on vehicle

View File

@@ -0,0 +1,96 @@
// :CATEGORY:Vehicles
// :NAME:A_flight_script_with_more_realistic
// :AUTHOR:Fritz Kakapo
// :CREATED:2010-12-28 21:16:02.003
// :EDITED:2013-09-18 15:38:47
// :ID:8
// :NUM:13
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// To fly, this also requires the pilot seat script, also in the root prim.
// :CODE:
//string sit_anim = "vseat"; This sit annimation didn't work. The pilot scrapes on the ground too badly.
key pilot;
//
default
{
// Vario-position Pilot Seat for Pietenpol Air Camper
// Ezekiel Bailly
// CopyLeft
// Current Limitation is that Pilot needs to standup and then re-sit to effect change
//
state_entry()
{
pilot = NULL_KEY;
llListen( 0, "", llGetOwner(), "" );
llSitTarget( < 0.3, 0.0, 0.40 >, llEuler2Rot(<0,0,0>) ); // Start in up position.
}
//
changed(integer change)
{
key sitting = llAvatarOnSitTarget();
if ( change & CHANGED_LINK )
{
if ( sitting != NULL_KEY && pilot == NULL_KEY )
{
if ( sitting = llGetOwner() )
{
pilot = sitting;
//llMessageLinked( 1, 0, "llWhisper", "/me pilotr " + llKey2Name(sitting) );
//if (sit_anim != "")
//{
llRequestPermissions(pilot, PERMISSION_TRIGGER_ANIMATION);
//}
}
}
else if ( sitting == NULL_KEY && pilot != NULL_KEY )
{
if ( (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) == PERMISSION_TRIGGER_ANIMATION && llGetPermissionsKey() == pilot )
{
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_PHANTOM, TRUE);
//llStopAnimation(sit_anim);
llSleep(2.0);