Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. @name Steering [PcmciaKai]
  2. @inputs [Controller Hl Hr]:wirelink Left Right
  3. @outputs Norm Speed Lock Steer
  4. if (first() | dupefinished()) {
  5.     runOnTick(1)
  6.     timer("init",100)  
  7.     Hl["Constant",number] = Hr["Constant",number] = 1
  8.     Hl["Damping",number] = Hr["Damping",number] = 1
  9.     Hl["Length",number] = Hr["Length",number] = 1
  10.     Norm = 33.583 # Length of the hydraulics that they need to be centered (use accurate values)
  11.     Speed = 0.4
  12.     Lock = 21.4 # Hydraulic length to add on steering, basically defining a steering lock
  13. }
  14. elseif (clk("init")) {
  15.     Hl["Constant",number] = Hr["Constant",number] = 50000
  16.     Hl["Damping",number] = Hr["Damping",number] = 1000
  17. }
  18.  
  19. #Steer = round(clamp(entity():isConstrainedTo():toLocal(Controller["Entity",entity]:driver():eyeAngles()):yaw()+90,-90,90))*(Lock/90) # Mouse steering BETA
  20. Steer += clamp((Left-Right)*Lock-Steer,-Speed,Speed)
  21.  
  22. Hl["Length",number] = Norm-Steer
  23. Hr["Length",number] = Norm+Steer