Facebook
From 01Kiko, 1 Month ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 108
  1. function PHYTool:calculateNewAcceleration(newAcceleration)
  2.     local initialVelocity = self.initialVelocity
  3.     local finalVelocity = math.sqrt(initialVelocity* initialVelocity + 2 * newAcceleration * self.distance)
  4.     self.finalVelocity = finalVelocity
  5.     self.time = (finalVelocity - initialVelocity) / newAcceleration
  6.     self.averageVelocity = 0.5 * initialVelocity + 0.5 * finalVelocity
  7. end