Spoilers (for Vehicles) - user-grinch/ModelExtras GitHub Wiki
Spoilers can be animated to move when the vehicle's speed exceeds a certain threshold. The spoiler will adjust its rotation dynamically based on the speed, adding a realistic, responsive effect.
When a vehicle reaches a predefined speed, the spoiler will begin to animate, rotating according to the configured speed. The speed threshold, rotation angle, and animation time are customizable through the JSONC configuration, or alternatively, you can add rotation and time information directly to the model dummy itself.
- Rotation: Defines how much the spoiler rotates.
- Trigger Speed: The speed at which the spoiler starts to move.
- Time: Duration for the spoiler to reach its maximum rotation.
You can configure animated spoilers in two ways:
Spoilers are configured through a JSONC file, stored in ModelExtras/data/
. The following structure allows you to control the spoiler's animation properties.
📂 File Location & Structure
📌 Path: ModelExtras/data/<FILENAME>.jsonc
Tip: It is recommended to use model names instead of model IDs to avoid conflicts with other mods — especially when using added vehicles.
{
"spoilers": {
"SPOILER_NAME": {
"rotation": 30.0,
"time": 3000,
"triggerspeed": 20
}
}
}
-
SPOILER_NAME: The name of the spoiler node or dummy (e.g.,
movspoiler
,movspoiler2_30.0_3000
(if using params),movspoiler3
- This must match the vehicle dummy name). -
Rotation: The maximum rotation of the spoiler when triggered. (
float
, default is 30.0 degrees). -
Time: The duration in milliseconds for the spoiler to fully rotate. (
int
, default is 3000 ms). -
TriggerSpeed: The vehicle speed (in km/h) required to trigger the animation. (
int
, default is 20 km/h).
Alternatively, you can configure the spoiler directly within the model's dummy by naming the dummy in the following format:
movspoiler_<rotation_in_float>_<time_in_ms_int>
For example:
-
movspoiler_40.0_4000
where:-
40.0
is the rotation in degrees. -
4000
is the time in milliseconds for the animation.
-
This method eliminates the need for a separate JSONC file but is less flexible. JSONC configuration is the recommended approach for more control.
In some vehicles, you may have multiple spoilers, such as additional or adjustable spoilers on different parts of the vehicle. To configure multiple spoilers, you simply need to extend the naming convention used in the dummy, appending a number after the movspoiler
prefix.
For example, if a vehicle has multiple spoilers, you can configure them as follows:
-
movspoiler_1_30.0_3000
for the first spoiler. -
movspoiler_2_40.0_4000
for the second spoiler. -
movspoiler_3_50.0_5000
for the third spoiler.
Animated spoilers add a dynamic, immersive effect to your vehicle, making it feel more responsive to changes in speed. You can easily set up animated spoilers using either the JSONC configuration (recommended) or by directly naming the model's dummy according to the movspoiler_<rotation>_<time>
convention.