CylinderAnimator initializes cylinders from lua. You can also achieve the same effect by adding the LuaCylinder component to the object via Modding SDK.

The script needs three indexes:

  1. cylinderIndex specifies the cylinder. It will always be rotated in such way that its Z axis hits the target.
  2. pistonIndex represents the piston. This should be a child object of the cylinder. Its pivot will be placed exactly to the target.
  3. targetIndex specifies the target.

In many use cases, the cylinder will be the child of some stationary part (e.g. the body of a snowcat). On the other hand, the target will be child of some moving part (e.g. the snowcat's groomer or blade). CylinderAnimator ensures that the cylinder will always be connected to the target.

For performance reasons, the actual runtime calculations are done via C#. If necessary, you can view the source code in the Modding SDK.

  35  CylinderAnimator                    = CylinderAnimator or {};


This sets up the LuaCylinder component for each cylinder in the data table.

  39  function CylinderAnimator:load(dataTable)
  40      self.cylinders                  = {};
  42      if dataTable.cylinders ~= nil then
  43          for k, v in pairs(dataTable.cylinders) do
  44              local id                = getChild(, v.cylinder or v.cylinderIndex or "");
  46              if id ~= nil then
  47                  local cylinder      = {};
  48                  cylinder.cylinderId = id;
  49                  cylinder.pistonId   = getChild(, v.piston or v.pistonIndex or "");
  50                  cylinder.targetId   = getChild(, or v.targetIndex or "");
  52                  table.insert(self.cylinders, cylinder);
  54                  -- update by C#
  55        , cylinder.pistonId, cylinder.targetId);
  56              end;
  57          end;
  58      end;
  59  end;

All contents of this page may be used for modding use for Winter Resort Simulator only. Any use exceeding this regulation is not permitted.

Copyright (C) HR Innoways, 2020. All Rights Reserved.