Advertisement
RA2lover

RigidChips LSF Concept

May 13th, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. // [RCD]
  2. Val
  3. {
  4. PITCHFORCE(default=0, min=-1000000, max=1000000)
  5. ROLLFORCE(default=0, min=-1000000, max=1000000)
  6. ROLLJETL(default=0, min=-1000000, max=1000000)
  7. ROLLJETR(default=0, min=-1000000, max=1000000)
  8. SIDEFORCE(default=0, min=-1000000, max=1000000)
  9. SPEED(default=0, min=-50, max=135)
  10. THRUSTERJETF(default=0, min=-1000000, max=1000000)
  11. THRUSTERJETR(default=0, min=-1000000, max=1000000)
  12. UPFORCE(default=0, min=-1000000, max=1000000)
  13. YAWFORCE(default=0, min=-1000000, max=1000000)
  14. YAWJETF(default=0, min=-1000000, max=1000000)
  15. YAWJETR(default=0, min=-1000000, max=1000000)
  16. }
  17. Key
  18. {
  19. }
  20. Body
  21. {
  22. Core(name=CORE) {
  23. S:Chip() {
  24. S:Frame(angle=150) {
  25. S:Weight(angle=-150) {
  26. S:Jet(angle=-90, power=THRUSTJETF) { }
  27. S:Weight() {
  28. S:Weight() {
  29. E:Cowl(angle=-30, option=4) { }
  30. W:Cowl(angle=-30, option=3) { }
  31. }
  32. }
  33. S:Weight(angle=-90) {
  34. S:Weight(angle=90) {
  35. S:Weight() {
  36. E:Cowl(angle=30, option=4) { }
  37. W:Cowl(angle=30, option=3) { }
  38. S:Jet(angle=90, power=0, option=2) { }
  39. S:Jet(angle=90, power=-THRUSTJETR) { }
  40. }
  41. }
  42. S:Weight(angle=-90) { }
  43. }
  44. }
  45. }
  46. S:TrimF(angle=90) {
  47. S:Jet(power=YAWJET2) { }
  48. S:Jet(angle=180, power=-YAWJETF) { }
  49. }
  50. S:Jet(power=PITCHJETF) {
  51. S:Jet(power=PITCHJETR) { }
  52. W:Jet(power=ROLLJETL) {
  53. S:Cowl(option=4) { }
  54. S:Weight(angle=-30) {
  55. W:Cowl(angle=89, option=3) { }
  56. }
  57. S:Weight(angle=30) {
  58. W:Cowl(angle=-89, option=3) { }
  59. }
  60. }
  61. E:Jet(power=ROLLJETR) {
  62. S:Cowl(option=3) { }
  63. S:Weight(angle=-30) {
  64. E:Cowl(angle=89, option=4) { }
  65. }
  66. S:Weight(angle=30) {
  67. E:Cowl(angle=-89, option=4) { }
  68. }
  69. }
  70. S:Arm(power=999999999, option=-999999999) { }
  71. }
  72. }
  73. }
  74. }
  75. Lua
  76. {inertial = false
  77.  
  78. --pardon my function laziness mayhem
  79. function increasespeed(step)
  80. SPEED=SPEED+step
  81. end
  82.  
  83. function decreasespeed(step)
  84. SPEED=SPEED-step
  85. end
  86.  
  87. function increaseyaw(step)
  88. YAWFORCE=YAWFORCE+step
  89. end
  90.  
  91. function decreaseyaw(step)
  92. YAWFORCE=YAWFORCE-step
  93. end
  94.  
  95. function increasepitch(step)
  96. PITCHFORCE=PITCHFORCE+step
  97. end
  98.  
  99. function decreasepitch(step)
  100. PITCHFORCE=PITCHFORCE-step
  101. end
  102.  
  103. function increaseroll(step)
  104. ROLLFORCE=ROLLFORCE+step
  105. end
  106.  
  107. function decreaseroll(step)
  108. ROLLFORCE=ROLLFORCE-step
  109. end
  110.  
  111. function increaseupforce(step)
  112. UPFORCE=UPFORCE+step
  113. end
  114.  
  115. function decreaseupforce(step)
  116. UPFORCE=UPFORCE-step
  117. end
  118.  
  119. function increasesideforce(step)
  120. SIDEFORCE=SIDEFORCE+step
  121. end
  122.  
  123. function decreasesideforce(step)
  124. SIDEFORCE=SIDEFORCE-step
  125. end
  126.  
  127. local imuchip=CORE--chip used for acceleration measurement
  128. local accs={0,0,0,0,0,0} --accx,y,z; aaccx,y,z
  129. local oldv={0,0,0,0,0,0} --last frame's velocities
  130.  
  131. function calculateaccelerationframe()
  132. local c=imuchip
  133. accs={_VX(c)-oldv[1],_VY(c)-oldv[2],_VZ(c)-oldv[3],_WX(c)-oldv[4],_WY(c)-oldv[5],_WZ(c)-oldv[6]}
  134. oldv={_VX(c),_VY(c),_VZ(c),_WX(c),_WY(c),_WZ(c)}
  135. end
  136.  
  137.  
  138. function calculatejets()
  139. THRUSTJETF=(SPEED-_VZ()*speedp)-(accs[3]*speedd)
  140. THRUSTJETR=THRUSTJETF
  141. PITCHJETF=UPFORCE+PITCHFORCE
  142. PITCHJETR=UPFORCE-PITCHFORCE
  143. YAWJETF=SIDEFORCE+YAWFORCE
  144. YAWJETR=SIDEFORCE-YAWFORCE
  145. ROLLJETL=ROLLFORCE
  146. ROLLJETR=ROLLFORCE
  147. end
  148.  
  149. --controls
  150. speedp=10000
  151. speedd=10000
  152. key={}
  153. key[15]={increaseupforce, 30000}
  154. key[8]={decreaseupforce, 30000}
  155. key[7]={increasesideforce,30000}
  156. key[9]={decreasesideforce,30000}
  157. key[10]={decreasespeed,3}
  158. key[12]={increasespeed,1}
  159.  
  160. function main()
  161. calculateaccelerationframe()
  162. calculatejets()
  163.  
  164. for k,v in ipairs(key) do
  165. if _KEY(key[k])>0 then v[1](v[2]) end
  166. end
  167.  
  168.  
  169. _ZOOM(90)
  170. end}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement