2
0

setSpring.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. return {
  2. summary = 'Set the spring parameters of the SliderJoint limits.',
  3. description = [[
  4. Sets the spring parameters of the SliderJoint. Use this to make the position limits of the
  5. slider "soft". When the motor is active, a separate set of spring parameters can be set on the
  6. motor, see `SliderJoint:setMotorSpring`.
  7. ]],
  8. arguments = {
  9. frequency = {
  10. type = 'number',
  11. default = '0.0',
  12. description = [[
  13. The frequency of the spring, in hertz. Higher frequencies make the spring more stiff. When
  14. zero, the spring is disabled.
  15. ]]
  16. },
  17. damping = {
  18. type = 'number',
  19. default = '1.0',
  20. description = 'The damping ratio of the spring.'
  21. }
  22. },
  23. returns = {},
  24. variants = {
  25. {
  26. arguments = { 'frequency', 'damping' },
  27. returns = {}
  28. }
  29. },
  30. notes = [[
  31. Higher frequencies make the spring more stiff. When zero (the default), the spring is disabled
  32. and the limits will be as stiff as possible.
  33. The damping ratio controls how quickly the oscillation slows down:
  34. - Undamped: Zero damping will cause the spring to oscillate forever. (Note that the spring may
  35. still lose a small amount of energy over time).
  36. - Underdamped: Damping less than one results in a system that is underdamped. The spring will
  37. oscillate around the target, but the oscillations will decay over time, eventually stabilizing
  38. at the target.
  39. - Overdamped: Damping greater than one will not have any oscillation, and the spring will take
  40. extra time to reach the target.
  41. - Critical Damping: When the damping is exactly 1.0, there is no oscillation and the spring
  42. takes the minimum amount of time to reach the target (based on the frequency).
  43. ]],
  44. related = {
  45. 'SliderJoint:getMotorSpring',
  46. 'SliderJoint:setMotorSpring'
  47. }
  48. }