Kayin Zugzwang
A Superior Grouch
Join date: 7 Jun 2004
Posts: 269
|
09-23-2004 00:28
Alright. I'm trying to script something and I have some issues but also would like to get more skilled up in trying to make a script for the community as well. Maybe Cubey Terra and company would be interested in this as well. We'll see I suppose. I couldn't find a mouselook plane script anywhere so I modified the hoverbike script to be rather planish, but something about it doesn't feel right. Nor do the controls match what I would like to achieve. The Main Goal - -Make a mouselook airplane script with little "wobble( as the mouse tracks the mouse pointer) -Make the plane respond and turn more like a plane(no floating in air anti gravity or anything) -Banking doesn't turn the plane. One can bank with the keys and "pull up" to achieve a turn. A mouse would simulate a "rudder" turn. The Secondary Goals - (I might need help in a knowledge sense for these, but scripting would be handlable by me and my goons. We have a lot of it already planned out) - Impact Damage - Breakable Parts(Pieces delink and derez from impact) - Weapons and weapon damage to vehicles -Damage effects(from simple turning issues due to rudder damage/loss to spirally death due to wing lost and explosive delinking do to massive fusaloge damage). - Advanced simulated physics, probably involving checking rotations and velocities and applying force/impulse/motor force to simulate proper effects. Probably unlikely, but still concievable and interesting. The main goal is to make these scripts PUBLIC. I would love to see dogfights in old warbirds in SL using these scripts. Making them available to the masses will simply help this along. I'm not interested in people who are looking for some L$ or people to take commission(unless you have some planes you're going to see using these scripts  ). I want some people who want to try and help along the Second Life community and the fun that can be had with vehicles.
|
Jeff Coral
Registered User
Join date: 27 Oct 2003
Posts: 22
|
09-26-2004 09:19
This sounds awesome! I can't script though =/
|
Kayin Zugzwang
A Superior Grouch
Join date: 7 Jun 2004
Posts: 269
|
09-28-2004 00:36
Project is still up and going without any help so far. The mouselook script is giving some issues that might cause me just to rewrite it, as it was made from a modified hoverbike script. The plane cannot point straight up or straight down. The keybanking almost seems right out, so I might have to adjust it so that the mouse banks and the keys turn. Basic damage system has been tested on a dummy. The current working ship is a Huges Devestator Mk III from Crimson Skies, which is awesome enough on its own. Still, I could use assistance of someone versed in mouselook to help this along. For reference(since I intend all this to be public anyways) // example mouselook hoverbike // // Uses "mouselook" to steer, which is new for SL 1.4.
integer gUseMouseLookSteer = TRUE;
float gMaxTurnSpeed = 5; float gMaxWheelieSpeed = 5; float gMaxFwdSpeed = 50; float gMaxBackSpeed = -10; float gAngularRamp = 0.17; float gLinearRamp = 0.2;
// These are true globals whose values are "accumulated" over // multiple control() callbacks. float gBank = 0.0; vector gLinearMotor = <0, 0, 0>; vector gAngularMotor = <0, 0, 0>;
default { state_entry() { // init stuff that never changes llSetSitText("Ride"); llCollisionSound("", 0.0); llSitTarget(<0.01, 0.05, 0.8>, ZERO_ROTATION); llSetCameraEyeOffset(<-6.0, 0.0, 1.0> ); llSetCameraAtOffset(<3.0, 0.0, 1.0> );
// create the vehicle llSetVehicleFlags(-1); llSetVehicleType(VEHICLE_TYPE_AIRPLANE);
llRemoveVehicleFlags(VEHICLE_FLAG_LIMIT_ROLL_ONLY) ; llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2); llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80); llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.5); llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.50);
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 0.8); llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 20);
if (gUseMouseLookSteer) { // non-bank mouselook llRemoveVehicleFlags(VEHICLE_FLAG_MOUSELOOK_BANK);
llSetVehicleFlags(VEHICLE_FLAG_MOUSELOOK_STEER | VEHICLE_FLAG_CAMERA_DECOUPLED); llRemoveVehicleFlags( VEHICLE_FLAG_CAMERA_DECOUPLED); llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.5); llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <0, 15, 10> ); llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 100); // irrelevent for mouselook llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <100, 10, 5> ); } else { // mouselook banking llRemoveVehicleFlags(VEHICLE_FLAG_MOUSELOOK_STEER) ; llSetVehicleFlags(VEHICLE_FLAG_MOUSELOOK_BANK );//| VEHICLE_FLAG_CAMERA_DECOUPLED); llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.5); llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, <10, 10, 0> ); llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 100); // irrelevent for mouselook llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <1000, 1000, 500> );
llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 2.5); llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 0.7); llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.01);
} llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 1000, 1000> );
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.1); llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 1.5);
}
changed(integer change) { if (change & CHANGED_LINK) { key agent = llAvatarOnSitTarget(); if (agent) { if (agent != llGetOwner()) { // owner has mounted llSay(0, "You aren't the owner"); llUnSit(agent); llPushObject(agent, <0,0,100>, ZERO_VECTOR, FALSE); } else { // not the owner ==> boot off llSetStatus(STATUS_PHYSICS, TRUE); llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
// reset the global accumulators gAngularMotor = <0, 0, 0>; gLinearMotor = <0, 0, 0>; gBank = 0.0; } } else { // dismount llSetStatus(STATUS_PHYSICS, FALSE); llReleaseControls(); llStopAnimation("motorcycle_sit"); } }
}
run_time_permissions(integer perm) { if (perm) { llStartAnimation("motorcycle_sit"); llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_ML_LBUTTON | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_UP, TRUE, FALSE); } }
control(key id, integer level, integer edge) { // The idea here is to ramp up the motors when the keys are held down for a long // time and to let the motors decay after they are let go. This allows fine- // tuning of the motion of the vehicle by throttling the key controls. // // Note that this probably doesn't work well when the client FPS and/or the server // FPS is lagging. So for best results you'll want to turn off as much visual // effects as you can tolerate, and drive in the more empty areas.
// linear integer key_control = FALSE; // if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT)) // { // // add roll component ==> triggers banking behavior // gLinearMotor.y += 10; // } // if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT)) // { // gLinearMotor.y -= 10; // }
if(level & CONTROL_ML_LBUTTON && llGetTime() > 0.5) { llResetTime(); llMessageLinked(LINK_SET, 66, "fire", ""); }
if(level & CONTROL_FWD) { gLinearMotor.x = gLinearMotor.x + gLinearRamp * (gMaxFwdSpeed - gLinearMotor.x); key_control = TRUE; } if(level & CONTROL_BACK) { gLinearMotor.x = gLinearMotor.x + gLinearRamp * (gMaxBackSpeed - gLinearMotor.x); key_control = TRUE; } if (key_control) { llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, gLinearMotor); key_control = FALSE; }
} }

|
Apotheus Silverman
I write code.
Join date: 17 Nov 2003
Posts: 416
|
09-28-2004 09:38
From: someone -Banking doesn't turn the plane. One can bank with the keys and "pull up" to achieve a turn. A mouse would simulate a "rudder" turn.
This may only be possible through the use of llApplyRotationalImpulse() or llSetTorque() since mouselook steering takes complete control of the entire angular motor whether you want it to or not. From: someone - Advanced simulated physics, probably involving checking rotations and velocities and applying force/impulse/motor force to simulate proper effects. Probably unlikely, but still concievable and interesting.
This will take considerable time and effort unless you happen to be a real physics and trig geek with real-world flying experience. My aircraft slow down when ascending according to thrust limitation, speed up when descending according to drag profile, experience slipstream altitude loss when banked, and stall realistically (with stall warning). They also calculate and simulate lift, which makes for incredibly realistic take-offs and landings. I've taken the routines (two of them) that do all these calculations, gave them modifiable parameters so I can easily apply different behaviors to different planes, and put it in all of my newer aircraft. Unfortunately I am not willing to give away the source for this as of yet, but I do wish you luck in your venture.
|
Kayin Zugzwang
A Superior Grouch
Join date: 7 Jun 2004
Posts: 269
|
09-30-2004 00:31
Hm, working on that banking will be a fun little venture.
Lucky for me I have the resources of a bunch of physics geeks and a pilot for the advanced physics if I go that far. It's still a ways off though -- until I get the vehicle controlling comfortably in other aspects. Adding to this I have 90 projects going on, I might just settle on a basic, more arcady flying script as well as the damage scripts.
|