GROUND VEHICLE MODEL BEHAVIOR HELPERS
Several templates which are of use to ground vehicle development are available in the package fs-base-aircrafts-common
, one of the core packages of Microsoft Flight Simulator. These templates can be used for various different things, which we'll be outlining here. For an example of how these templates are used, please see the following page:
ASOBO_Wheel_Roll
The template ASOBO_Wheel_Roll
helps to play an animation of rolling wheels for the vehicle, adapting the speed of the animation to the speed of the vehicle at all time. It takes two mandatory parameters: ANIM_NAME
, the name of the animation that "rolls" the wheels, and WHEEL_RADIUS
, the radius in meters of those wheels.
The animation must be linear, and be exactly one full rotation (360°) of the wheel (first frame and last frame of animation being different, and not a "duplicate").
For vehicles having several wheels of different size, we recommend creating an animation for each size of wheels, and using as many ASOBO_Wheel_Roll
templates, each with the correct radius.
ASOBO_Wheel_Turn
The template ASOBO_Wheel_Turn
helps to play an animation of wheels turning left or right when the vehicle itself turn left or right. It takes three mandatory parameters: ANIM_NAME
, the name of the animation, ORDER_MULTIPLIER
, specifying if animation has been created "left to right" or "right to left",and PERCENT_PER_SECOND
, the maximum speed of the animation in case the vehicle turns suddenly from sharp left to sharp right (or the other way around).
The animation should start at the angle for a sharp turn left, rotate until being straight in the middle frame, and keep rotating until sharp right angle for the last frame. The ORDER_MULTIPLIER
should then be 1 ; the animation can also be from right to left instead, in which case the ORDER_MULTIPLIER
should be -1.
The PERCENT_PER_SECOND
parameter can be higher than 100 if desired, but be warned that the Ground Vehicle AIs can sometimes switch from being turning right with a sharp angle to left with a sharp angle in a single frame, which means the animation would visibly "jump" from one side to the other if the PERCENT_PER_SECOND
is too high, leading to almost no "smoothing".
ASOBO_GroundVehicle_HeadLights
The template ASOBO_GroundVehicle_HeadLights
controls the headLights of the vehicle, turning them on or off when appropriate. It has no parameter.
The vehicle needs to have its headlights defined in the sim.cfg
file, as explained here:
[LIGHTS]
. The headlights will then be automatically turned off when the vehicle turns off its engine, and during the day.
ASOBO_GroundVehicle_BackLights
This behaves exactly as ASOBO_GroundVehicle_HeadLights
, but for BackLights instead of HeadLights.
ASOBO_GroundVehicle_GyroLights
This behaves similarily to ASOBO_GroundVehicle_HeadLights
, but for GyroLights instead of HeadLights. Although, GyroLights stay on during the day (while the engine is on), contrary to HeadLights and BackLights.
ASOBO_GroundVehicle_GyroLights_Animated
This behaves similarly to ASOBO_GroundVehicle_GyroLights
, with some addition. It requires two parameters: ANIM_NAME
, the name of an animation to play while Gyrolight is on, and PERCENT_PER_SECOND
, determining the speed of the animation.
This can be useful for example to have a rotating animation for the light. The animation should be able to loop smoothly, and will be played at all time when the Gyrolight is on, which is when the engine of the vehicle is on.
A value of PERCENT_PER_SECOND
of 100 means the animation will be played in 1 second before looping back to the start. 50 means the animation will take 2 seconds, while 200 would mean the animation is played in 0.5 second.