Vehicles
From OpenSimulator
KittoFlora (Talk | contribs) (→VEHICLE Scripting Notes) |
KittoFlora (Talk | contribs) (→Vehicle LSL Functions and Status) |
||
Line 68: | Line 68: | ||
!Function!!Set by LSL?!!Used by OpenSim C#!!Works?!!Comments | !Function!!Set by LSL?!!Used by OpenSim C#!!Works?!!Comments | ||
|- | |- | ||
− | |llSetPos()||Y||Y||Y|| | + | |llSetPos()||Y||Y||Y||Also works on physical objects! |
|- | |- | ||
− | |llSetRot()|| | + | |llSetRot()||Y||Y||Y||Y |
|- | |- | ||
− | |llSetLocalRot()||Y||Y||Y | + | |llSetLocalRot()||Y||Y||Y |
|- | |- | ||
|llSetScale()||N/A||N/A||N/A||N/A | |llSetScale()||N/A||N/A||N/A||N/A |
Revision as of 08:15, 15 September 2009
Contents |
Summary
August 2009: Kitto Flora is revising the OdePlugin files in an attempt to provide SL-compatible VEHICLE functionality to OpenSimulator. A couple of test regions have been provided by Bri Hasp, these are Sea-3 and Sea-4 in OSgrid. You may visit there and test vehicles but please clean up after. The regions will frequently be restarted to test revisions. The revised Open Simulator files are being made available as a git branch, check here to see what may or may not work.
Terminology
Here some terms are defined so that when we communicate we are talking about the same things.
Vehicle
Any object or link-set that moves. It is usually rideable. It may be Physical or not.
VEHICLE
Any object or link-set that uses LSL VEHICLE functions to achieve mobility. It is set to other than 'VEHICLE_TYPE_NONE'.
Physical
Any object or link-set that is llSetStatus(STATUS_PHYSICS, TRUE). It will fall due to gravity (unless buoyancy is changed) and collide with other prims, avatars and the ground (unless set phantom).
Non-Physical
Any object or link-set that is llSetStatus(STATUS_PHYSICS, FALSE), or has never has llSetStatus(STATUS_PHYSICS,...) applied. Such objects 'stick in midair' and can interpenetrate other objects.
Kinematic
Motion system used by Non-Physical objects, applied by such functions as llSetPos() and llSetRot().
Dynamic
Motion system used by Physical objects, applied by such functions as llSetForce() and llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <...>).
About This Project
The objectives of this project are:
- To provide VEHICLE associated LSL functions within OpenSimulator that are compatible with Second Life functionality. This means trying to get them really close, but as we are trying to emulate complex HAVOK functions using what is available in ODE they may be only close to the SL functions.
- To clean up the OdePlugin files. Over many revisions and add-ons they have become somewhat non-optimal. In particular the 'Move' operation that makes objects move around needs to be very clean and smooth so that the update rate remains high.
- Maintain the existing non-VEHICLE dynamic functions and fix errors where found.
Vehicle LSL Functions in revised OpenSimulator
There are three categories of LSL functions that are used by Vehicles: Kinematic, Dynamic and VEHICLE. These are listed below with information on their current status within the revised OpenSimulator. (Not the general release at this time.) Kinematic vehicle motion can be used by non-physical objects. VEHICLE motion and the associated functions ONLY apply to objects that are set to a VEHICLE_TYPE of AIRPLANE, BALLOON, BOAT, CAR or SLED. Dynamic functions ONLY apply (at this time) to VEHICLE_TYPE_NONE, which is the default condition of an object. (In SL it appears that one can use Dynamic functions on a VEHICLE, but to keep things simple at the start of this project such a combination is ignored.)
Known Problems
- timer() event ceases about 10 seconds after Vehicle moves. Does not restart until many seconds after Vehicle stops. Work-around: Use llSensor() for a non-existent object at short range and no_sensor() event to re-trigger it. This produces about 1000 events per second. Divide down to produce more reasonable rates.
- llSetBuoyancy() is not hooked to physics methods. LSL engine problem. Work-around: None. Big problem for non-VEHICLE vehicles.
- llSetHoverHeight() is not hooked to physics methods. LSL engine problem. Work-around: None. Big problem for non VEHICLE vehicles.
- llSetVehicleFlags() and llRemoveVehicleFlags() are not hooked to physics methods, and may cause simulator crash. LSL engine problem. Work-around: None, but the VEHICLE_TYPE presets are setting necessary flags.
- Prim parameters like Material are not being saved. Work-around: Set by script on rez or whenever used.
- Script state is not maintained between Take and Rez. Work-around: on_rez() Reset script and set *everything* again.
- Border Crossing is bad. Vehicle will be killed and Av unseated and left drifting through target region. Work-around: Quickly double-click on Map to tele-port to old region. Drag vehicle back and reset it.
VEHICLE Scripting Notes
- (Not really scripting , but very important) DO NOT attempt to drive a VEHICLE across the Region boundary. If you do your Av will be orbited. You may be able to recover by Map double-click TP to a nearby Region. The VEHICLE object is usually killed, and sitting at edge of the destination region.
- In revised OpenSimulator the function llSetVehicleType(VEHICLE_TYPE_xxx), where xxx is AIRPLANE, BALLOON, BOAT, CAR or SLED, pre-sets all the applicable VEHICLE parameters to reasonable numbers. If you wish to change any of these pre-set parameters do so after asserting llSetVehicleType(VEHICLE_TYPE_xxx).
- At present it appears that some conditions within an instantiated scripted object are not maintained after a Region restart, and possibly between take and rez. Therefore you should assert llSetVehicleType(VEHICLE_TYPE_xxx) when the driver sits and llSetVehicleType(VEHICLE_TYPE_NONE)when the driver stands, and probably on_rez.
- The advice above also applies to camera controls. Assert llSetCameraxxx() on sit and llClearCameraParams() on stand. (At present there seems to be bugs in the Camera Control system, the camera will go underground!)
- The advice above is also true of Material Type. Land vehicles need the 'wheels' to be PRIM_MATERIAL_GLASS. The script(s) must llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_GLASS]) in every prim that touches the ground, when the rider sits, for reliable operation. Use a link mesage from the root to daughter prim scripts.
- Use llSetStatus(STATUS_PHYSICS, TRUE) to enable the VEHICLE, usually when the driver sits. Use llSetStatus(STATUS_PHYSICS, FALSE) to disable the VEHICLE, usually when the driver stands.
- It appears that the timer() event freezes while a Vehicle is in motion, so do not rely in Timer() to update things like steering or velocity. See Known Problems for a work-around.
Vehicle LSL Functions and Status
NOTE! This list applies to the revised OpenSimulator, not the released OpenSimulator.
Key: Y = Yes; N = No; F = Framework present but commented out; N/A = Has not been checked (much) yet
KINEMATIC
Object must not be PHYSICAL
(Some work, some do not.)
Function | Set by LSL? | Used by OpenSim C# | Works? | Comments |
---|---|---|---|---|
llSetPos() | Y | Y | Y | Also works on physical objects! |
llSetRot() | Y | Y | Y | Y |
llSetLocalRot() | Y | Y | Y | |
llSetScale() | N/A | N/A | N/A | N/A |
llLookAt() | N/A | N/A | N/A | N/A |
llRotLookAt() | N/A | N/A | N/A | N/A |
llSetPrimitiveParams() | N/A | N/A | N/A | N/A |
llSetLinkPrimitiveParams() | N/A | N/A | N/A | N/A |
llTargetOmega() | N/A | N/A | N/A | N/A |
DYNAMIC
Object must be PHYSICAL and VEHICLE_TYPE_NONE(default) at present, but this must probably change.
(Some work, some do not.)
Function | Parameter | Set by LSL? | Used by OpenSim C# | Comments |
---|---|---|---|---|
llApplyImpulse() | N/A | N/A | N/A | N/A |
llApplyRotationalImpulse() | N/A | N/A | N/A | N/A |
llGroundRepel() | N/A | N/A | N/A | N/A |
llMoveToTarget() | N/A | N/A | N/A | N/A |
llPushObject() | N/A | N/A | N/A | N/A |
llSetBuoyancy() | N/A | N/A | N/A | (do not confuse with VEHICLE_BUOYANCY) |
llSetForce() | N/A | N/A | N/A | N/A |
llSetForceAndTorque() | N/A | N/A | N/A | N/A |
llSetHoverHeight() | N/A | N/A | N/A | (do not confuse with VEHICLE_HOVER_HEIGHT) |
llSetTorque() | N/A | N/A | N/A | N/A |
llTargetOmega() | N/A | N/A | N/A | N/A |
llLookAt() | N/A | N/A | N/A | N/A |
llRotLookAt() | N/A | N/A | N/A | N/A |
llSetPrimitiveParams() | N/A | N/A | N/A | N/A |
llSetLinkPrimitiveParams() | N/A | N/A | N/A | N/A |
llTargetOmega() | N/A | N/A | N/A | N/A |
VEHICLE
Object must be PHYSICAL and VEHICLE_TYPE_<other than NONE>
Functions | Set by LSL? | Used | Works | Exceptions |
---|---|---|---|---|
llSetVehicleType() | Y | Y | Y | |
llSetVehicleFlags() | N | N | N | Some flags are set by llSetVehicleType() |
llRemoveVehicleFlags() | N | N | N | |
llSetVehicleFloatParam() | Y | Y | Y | |
llSetVehicleVectorParam() | Y | Y | Y | |
llSetVehicleRotationParam() | Y | Y | Y |
Parameters | Set by LSL? | Used | Works | Exceptions |
---|---|---|---|---|
VEHICLE_LINEAR_MOTOR_DIRECTION | Y | Y | Y | |
VEHICLE_LINEAR_MOTOR_TIMESCALE | Y | Y | Y | |
VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE | Y | Y | Y | |
VEHICLE_LINEAR_FRICTION_TIMESCALE | Y | Y | Y | |
VEHICLE_LINEAR_MOTOR_OFFSET | F | N | ||
VEHICLE_ANGULAR_MOTOR_DIRECTION | Y | Y | Y | |
VEHICLE_ANGULAR_MOTOR_TIMESCALE | Y | Y | Y | |
VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE | Y | Y | Y | |
VEHICLE_ANGULAR_FRICTION_TIMESCALE | Y | Y | Y | |
VEHICLE_BANKING_EFFICIENCY | F | N | ||
VEHICLE_BANKING_MIX | F | N | ||
VEHICLE_BANKING_TIMESCALE | F | N | ||
VEHICLE_BUOYANCY | Y | Y | Y | (do not confuse with llSetBuoyancy()) |
VEHICLE_HOVER_HEIGHT | Y | Y | Y | (do not confuse with llSetHoverHeight()) |
VEHICLE_HOVER_EFFICIENCY | Y | N | ||
VEHICLE_HOVER_TIMESCALE | Y | N | ||
VEHICLE_LINEAR_DEFLECTION_EFFICIENCY | F | N | ||
VEHICLE_LINEAR_DEFLECTION_TIMESCALE | F | N | ||
VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY | F | N | ||
VEHICLE_ANGULAR_DEFLECTION_TIMESCALE | F | N | ||
VEHICLE_REFERENCE_FRAME | F | N | ||
VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY | Y | Y | Y | |
VEHICLE_VERTICAL_ATTRACTION_TIMESCALE | Y | Y | Y | |
VEHICLE_TYPE_NONE | Y | Y | Y | |
VEHICLE_TYPE_BALLOON | Y | Y | Y | |
VEHICLE_TYPE_BOAT | Y | Y | Y | |
VEHICLE_TYPE_CAR | Y | Y | Y | |
VEHICLE_TYPE_SLED | Y | Y | Y | |
VEHICLE_FLAG_NO_DEFLECTION_UP | Y | N | ||
VEHICLE_FLAG_LIMIT_ROLL_ONLY | Y | N | ||
VEHICLE_FLAG_HOVER_WATER_ONLY | Y | Y | ||
VEHICLE_FLAG_HOVER_TERRAIN_ONLY | Y | Y | ||
VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT | Y | Y | ||
VEHICLE_FLAG_HOVER_UP_ONLY | Y | Y | ||
VEHICLE_FLAG_LIMIT_MOTOR_UP | Y | N | ||
VEHICLE_FLAG_MOUSELOOK_STEER | Y | N | ||
VEHICLE_FLAG_MOUSELOOK_BANK | Y | N | ||
VEHICLE_FLAG_CAMERA_DECOUPLED | Y | N |