getSpring.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. return {
  2. summary = 'Get the spring parameters of the joint.',
  3. description = [[
  4. Returns the DistanceJoint's spring parameters. Use this to control how fast the joint pulls the
  5. colliders back together at the distance limits.
  6. ]],
  7. arguments = {},
  8. returns = {
  9. frequency = {
  10. type = 'number',
  11. description = [[
  12. The frequency of the spring, in hertz. Higher frequencies make the spring more stiff. When
  13. zero, the spring is disabled.
  14. ]]
  15. },
  16. damping = {
  17. type = 'number',
  18. description = 'The damping ratio of the spring.'
  19. }
  20. },
  21. variants = {
  22. {
  23. arguments = {},
  24. returns = { 'frequency', 'damping' }
  25. }
  26. },
  27. notes = [[
  28. Higher frequencies make the spring more stiff. When zero (the default), the spring is disabled
  29. and the limits will be as stiff as possible.
  30. The damping ratio controls how quickly the oscillation slows down:
  31. - Undamped: Zero damping will cause the spring to oscillate forever. (Note that the spring may
  32. still lose a small amount of energy over time).
  33. - Underdamped: Damping less than one results in a system that is underdamped. The spring will
  34. oscillate around the target, but the oscillations will decay over time, eventually stabilizing
  35. at the target.
  36. - Overdamped: Damping greater than one will not have any oscillation, and the spring will take
  37. extra time to reach the target.
  38. - Critical Damping: When the damping is exactly 1.0, there is no oscillation and the spring
  39. takes the minimum amount of time to reach the target (based on the frequency).
  40. The default damping ratio is 1.
  41. ]]
  42. }