llSetVehicleFlags(integer flag)
llSetVehicleFlags sets special
vehicle behaviors.
There are a few aspects of vehicle behavior that are not defined in the
parameters which help define special cases such as vehicles that can only hover over water, or can not motor vertically. The correct vehicle flag settings go a long way toward creating a good vehicle.
Like the vehicle parameters, these should be set after a vehicle type is defined. Multiple flags can be set at once by
ORing them together. Flags can be removed using
llRemoveVehicleFlags.
Flag constants:
Constant | Value | Description |
VEHICLE_FLAG_NO_DEFLECTION_UP | 1 | Prevents linear deflection parallel to world-z axis |
VEHICLE_FLAG_LIMIT_ROLL_ONLY | 2 | Removes vertical attraction for changes in vehicle pitch |
VEHICLE_FLAG_HOVER_WATER_ONLY | 4 | Hover only pays attention to water level |
VEHICLE_FLAG_HOVER_TERRAIN_ONLY | 8 | Hover only pays attention to terrain height |
VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT | 16 | Hover only pays attention to global height |
VEHICLE_FLAG_HOVER_UP_ONLY | 32 | Hover only pushes up |
VEHICLE_FLAG_LIMIT_MOTOR_UP | 64 | Prevents ground vehicles from motoring into the sky |
VEHICLE_FLAG_MOUSELOOK_STEER | 128 | Makes vehicle try to turn toward mouselook direction |
VEHICLE_FLAG_MOUSELOOK_BANK | 256 | Makes vehicle try to turn toward mouselook direction assuming banking is enabled |
VEHICLE_FLAG_CAMERA_DECOUPLED | 512 | Causes the camera look-at axis to NOT move when the vehicle rotates |
Examples:
Retired Names:
Old Name | New Name |
VEHICLE_FLAG_NO_FLY_UP | VEHICLE_FLAG_NO_DEFLECTION_UP |
From the
SL 1.4 Preview Notes (very out of date)
Andrew Linden posted:
Mouselook control of vehicles in 1.4
(One benefit of this feature is that, when used with a "decoupled camera" (see below), it should make vehicles much easier to steer, especially for people with bad
client-side FPS.)
Setting the new
VEHICLE_FLAG_MOUSELOOK_STEER flag will change the meaning of the
VEHICLE_ANGULAR_MOTOR_DIRECTION:
- When in mouselook the vehicle will try to turn such that it points in the same direction as your camera. The motor's speed about each axis is scaled by the components of VEHICLE_ANGULAR_MOTOR_DIRECTION parameter. That is, if you want the angular motor to ONLY swing the vehicle left and right (rotations about the vehicle's z-axis) then you might set it to something like <0,0,5> which would zero the x- and y-components of the motor (roll and pitch) while scaling the z-component (yaw) by 5. So if the mouse is looking PI/4 radians to the left, then the motor would try to rotate the vehicle at 5*PI/4 radians/second about its z-axis.
- The VEHICLE_ANGULAR_MOTOR_TIMESCALE is still in effect, so if you want to make the vehicle responsive, set it to a short timescale, and if you want the vehicle to be sluggish then set it to something long. However, VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE has no meaning when using "mouselook steer".
There is also a new flag called
VEHICLE_FLAG_MOUSELOOK_BANK. Basically it is the same as the
_STEER flag, except it interprets "yaw" as input for "roll". Combined with banking behavior the vehicle should bank left when you mouse left.
Note: when setting the motor direction using
_MOUSELOOK_BANK flag the components of the motor direction scale the speed after the rotation of the input. So if you wanted to limit the angular motor to only "roll" (no pitch) you would set the angular motor to something like <5,0,0>.
Also note:
By default the mouselook direction WILL CHANGE when the vehicle you are sitting on moves. So when you move the mouse away from center the vehicle will continue to turn until you center the mouse again. To disconnect the mouslook camera from the vehicle's rotation you need to also set the
VEHICLE_FLAG_CAMERA_DECOUPLED flag. I think most of you will want to enable this flag when using mouse control of vehicles.
Right now the mouselook mode only works when in mouselook, so when you go out of mouselook the vehicle will no longer be steerable. This is one of the things I'll try to fix before 1.4's actual release.
Also, Richard Linden wants to make mouse countrols work when in a 3rd person view, but he probably won't get that in for 1.4 before release. Probably in a patch.
vehicles |
functions