Configuring the part animation

From Kerbal Space Program 2 Modding Wiki
Jump to navigation Jump to search
  • In the Project window, click on the imported FBX object.
  • In the Inspector window, click on the Animation tab.
  • Set "Anim. Compression" to "Off".
  • Split the animation into four states in the "Clips" list: retracted, deploy, deployed, and retract.
    1. The retracted and deployed states are a single frame.
    2. You should prefix these states with the part name to avoid confusion if multiple parts of the mod contain animation.
  • Drop the part under model and unpack it completely.
  • In the Part folder, create an Animation Controller.
  • Double-click on the controller to open the Animator tab.
  • Drag the four states into the Animator tab.
    1. Start with retracted so that it automatically links to Entry, then the other three.
  • In the Animator Parameters tab, create:
    1. a boolean "isDeployed",
    2. a trigger "reverseAnimStateChange",
    3. a float "playbackMul" = 10.
  • Create the transitions between states.
    1. Entry → retracted
    2. retracted ↔︎ deploy
    3. deploy → deployed
    4. deployed ↔︎ retract
    5. retract → retracted
  • Click on the transition from retracted to deploy:
    1. set "Exit Time" to 0,
    2. uncheck "Has Exit Time",
    3. uncheck "Fixed Duration" (in Settings),
    4. set "Transition Duration" to 0,
    5. add the boolean "isDeployed" = True to the list of conditions,
    6. check the animation by playing it in the preview window.
  • Perform the same operation on the transition from deployed to retract, except that "isDeployed" = False.
  • Click on the transition from deploy to retracted:
    1. Set "Exit Time" to 0,
    2. Set "Transition Duration" to 0,
    3. Add the "reverseAnimStateChange" trigger to the list of conditions.
  • Perform the same operation on the transition from retract to deployed.
  • Click on the retracted state:
    1. Add the "Module_Anim State Informer" module.
  • Perform the same operation on deployed.
  • Click on the transition from deploy to deployed:
    1. Set "Exit Time" to 0.99,
    2. Set "Transition Duration" to 0.01.
  • Perform the same operation on the transition from retract to retracted.
  • Click on each state and in "Speed" > "Multiplier", select "Parameter". It should automatically display "playbackMul" in the dropdown. This is for playing the animation ten times faster in the VAB.
  • On the mesh, add the "Animator" module and select the controller under "Controller".
  • On the root part, click "Add Component" > "Module_Deployable".
    1. Set "Animator" to the mesh.