-
Notifications
You must be signed in to change notification settings - Fork 26
Adding and Moving Function Dials Functions
The main object of each vehicle has the SaccEntity script attached to it. This is the same object that has the animator and rigidbody scripts.
Within the SaccEntity there are 2 arrays named Dial_Functions_L and Dial_Functions_R. These contain the list of function scripts that the vehicle has equipped.
The order of the functions in the lists matters. The first script will the function that is at the 'up' direction on the dial, each successive function is next on the dial clockwise. The angles are automatically calculated so the full 360 is always used. If a slot is left empty, it's space will be taken on the dial, but it will be unselectable.
The function dial scripts themselves are contained in objects in the hierarchy under <vehiclename>/DialFunctions/L & /R. The prefab always has them listed in the order that they are in the the SaccEntity's arrays, but it is not required. I recommended always setting them to be in the same order to avoid confusion.
That handles the code side and actual functionality, but the visuals of the dial need to match so that the pilot knows how to use it. Inside the hierarchy under <vehiclename>/InVehicleOnly there are two objects named StickDisplayL and StickDisplayR. These must be modified to match the function arrays.
The first thing to do is to set the Mesh Filter script on these objects to the correct mesh to match the number of functions in the dial. Click on the small circle button to the right of the 'Mesh' input box, and you will see the current mesh listed next to 12 meshes of a similar name, each with a different number at the end. Choose the one that matches the number of functions in the dial. The one with no number at the end is 8, the old default (from before there was more than one).
Next, look at the children of the StickDisplay, and set up the labels in the each slot to match the functions that are in those slots. The first slot is the top-middle, proceeding clockwise. You must also move the '_funcon' objects to match the position of their respective functions. These are the objects light up to let the pilot know if the function is active. Each label mesh is named MFD_<functiontext>, if you wish to search for one using the Mesh Filter input.
If you wish the make your own label mesh, there is a mesh containg A-Z characters in MFD.fbx. note: I don't like this setup and plan on changing it in future. You could just replace each function name mesh with TextMeshPro objects.
The last important detail is that it's possible to offset the angle calculation by half of a function. This is important if you have an odd number of functions, and want there to be a divider between functions at the top rather than at the bottom, as the bottom is usually used for brake.
The SaccEntity has a tickboxes for 'Left/ RightDialDivideStraightUp' these options do just that, but to make the visuals match you must rotate the StickDisplayL/R objects by half a functions worth of angle. To do this select the StickDisplay object and move all of its children outside of it, then, in its Z rotation type '360/*-.5'. This will set it to the negative of half of the number of degrees that a function takes up, which is the correct offset to match how the code works. Now put the child objects back, and position them correctly. The first function is now the one to the right of the now top-middle divider.
Keyboard controls for function dials are done by the <vehiclename>/InVehicleOnly/PilotOnly/KeyboardControls object. SOME of the more complex DFUNCs have their own keyboard control setups on their own scripts.