Skip to content

[EN] Animation by condition

Valdir da Costa Júnior edited this page Jun 17, 2019 · 2 revisions

Play animations in a condition

Utility

Before proceeding, be sure to read the Introduction.

A multi-solution solution!
Using the VehFuncs' animation pattern, you can set a condition for it to be played. For example, you want a part to rotate when the engine turns on (you can think of the ignition key), you can set an animation (for example, rotates 30°) during the engine on condition.

It's kind of annoying to set up because you need to set a number and a letter, but it was necessary.

How to use

The node name must start with f_an.
Then set the mode number, and sub-mode letter, according to the list:

  • 0: Ping-pong. The anim will be going back and forth without any condition. For what? idk.
    • a: Default (no options at the moment).
  • 1: Engine off. The animation will play when the engine turns off (see, turn off, not turn on!).
    • a: Default.
    • b: Engine off / alarm on. This sub-mode is thought of folding rear-view mirrors. Use this mode so that in the future the player can choose between engine off and alarm on, because alarm would be more realistic but harder to see, then we will leave this decision to the player.
  • 2: Occupant. There is an occupant sitting on the seat. Similar to f_fpeg.
    • a: Driver.
    • b: Front passenger.
    • c: Back passenger 1. (I don't remember the side)
    • d: Back passenger 2. (I don't remember the side)
  • 3: High speed. Useful for opening spoilers at high speed. At moment, above 100 kmph, it will probably be configurable in the future.
    • a: Default.
  • 4: Brakes.
    • a: Default.
    • b: Only at high speed. Excellent to use along with the spoiler above, thus creating similar spoilers to the Bugatti Veyron, which lift in speed, and rotates while braking.
    • c: Only at high speed, and f_spoiler. Same as above, but with the addition of f_spoiler.

Then set the animation by following the new VehFuncs animation pattern (not yet written here, but you understand the examples).

Examples:


In the image above, you have a complete example of how to create folding mirrors (f_an1b, rotating 80° on the Z axis), and a spoiler that deploys at speed (f_an3b, moving 9cm on the Z axis), and rotates when braking (f_an4c, rotating -40° in the X axis in speed 8), similar to Bugatti Veyron among others sport cars.
Note that the spoiler also includes the fix for tuning spoilers.

I know, it seems confusing to look at, but you don't need to memorize every value, just go back on this page whenever you need it!
Words would be easier to memorize, but soon it would hit the 23 characters limit.

Clone this wiki locally