Browse Source

SliderJoint;

bjorn 1 year ago
parent
commit
b9b5a172f6
28 changed files with 470 additions and 174 deletions
  1. 1 1
      api/lovr/physics/HingeJoint/getMotorMode.lua
  2. 2 2
      api/lovr/physics/HingeJoint/getMotorTarget.lua
  3. 1 1
      api/lovr/physics/HingeJoint/setMotorMode.lua
  4. 1 0
      api/lovr/physics/HingeJoint/setMotorSpring.lua
  5. 5 5
      api/lovr/physics/HingeJoint/setMotorTarget.lua
  6. 1 1
      api/lovr/physics/Joint/getTorque.lua
  7. 5 2
      api/lovr/physics/SliderJoint/getAxis.lua
  8. 21 0
      api/lovr/physics/SliderJoint/getFriction.lua
  9. 13 12
      api/lovr/physics/SliderJoint/getLimits.lua
  10. 0 24
      api/lovr/physics/SliderJoint/getLowerLimit.lua
  11. 36 0
      api/lovr/physics/SliderJoint/getMaxMotorForce.lua
  12. 23 0
      api/lovr/physics/SliderJoint/getMotorForce.lua
  13. 25 0
      api/lovr/physics/SliderJoint/getMotorMode.lua
  14. 36 0
      api/lovr/physics/SliderJoint/getMotorSpring.lua
  15. 24 0
      api/lovr/physics/SliderJoint/getMotorTarget.lua
  16. 5 7
      api/lovr/physics/SliderJoint/getPosition.lua
  17. 50 0
      api/lovr/physics/SliderJoint/getSpring.lua
  18. 0 24
      api/lovr/physics/SliderJoint/getUpperLimit.lua
  19. 0 35
      api/lovr/physics/SliderJoint/setAxis.lua
  20. 21 0
      api/lovr/physics/SliderJoint/setFriction.lua
  21. 18 12
      api/lovr/physics/SliderJoint/setLimits.lua
  22. 0 24
      api/lovr/physics/SliderJoint/setLowerLimit.lua
  23. 38 0
      api/lovr/physics/SliderJoint/setMaxMotorForce.lua
  24. 30 0
      api/lovr/physics/SliderJoint/setMotorMode.lua
  25. 38 0
      api/lovr/physics/SliderJoint/setMotorSpring.lua
  26. 24 0
      api/lovr/physics/SliderJoint/setMotorTarget.lua
  27. 52 0
      api/lovr/physics/SliderJoint/setSpring.lua
  28. 0 24
      api/lovr/physics/SliderJoint/setUpperLimit.lua

+ 1 - 1
api/lovr/physics/HingeJoint/getMotorMode.lua

@@ -20,6 +20,6 @@ return {
   },
   },
   related = {
   related = {
     'HingeJoint:getMotorTarget',
     'HingeJoint:getMotorTarget',
-    'HingeJonit:setMotorTarget'
+    'HingeJoint:setMotorTarget'
   }
   }
 }
 }

+ 2 - 2
api/lovr/physics/HingeJoint/getMotorTarget.lua

@@ -1,7 +1,7 @@
 return {
 return {
   summary = 'Get the target of the hinge motor.',
   summary = 'Get the target of the hinge motor.',
   description = [[
   description = [[
-    Sets the target value for the HingeJoint's motor.  This is either a target angle or a target
+    Returns the target value for the HingeJoint's motor.  This is either a target angle or a target
     velocity, based on the mode set by `HingeJoint:setMotorMode`.
     velocity, based on the mode set by `HingeJoint:setMotorMode`.
   ]],
   ]],
   arguments = {},
   arguments = {},
@@ -14,7 +14,7 @@ return {
   variants = {
   variants = {
     {
     {
       arguments = {},
       arguments = {},
-      returns = { 'mode' }
+      returns = { 'target' }
     }
     }
   },
   },
   related = {
   related = {

+ 1 - 1
api/lovr/physics/HingeJoint/setMotorMode.lua

@@ -25,6 +25,6 @@ return {
   },
   },
   related = {
   related = {
     'HingeJoint:getMotorTarget',
     'HingeJoint:getMotorTarget',
-    'HingeJonit:setMotorTarget'
+    'HingeJoint:setMotorTarget'
   }
   }
 }
 }

+ 1 - 0
api/lovr/physics/HingeJoint/setMotorSpring.lua

@@ -21,6 +21,7 @@ return {
       description = 'The damping ratio of the spring.'
       description = 'The damping ratio of the spring.'
     }
     }
   },
   },
+  returns = {},
   variants = {
   variants = {
     {
     {
       arguments = { 'frequency', 'damping' },
       arguments = { 'frequency', 'damping' },

+ 5 - 5
api/lovr/physics/HingeJoint/setMotorTarget.lua

@@ -1,20 +1,20 @@
 return {
 return {
   summary = 'Set the target of the hinge motor.',
   summary = 'Set the target of the hinge motor.',
   description = [[
   description = [[
-    Returns the target value for the HingeJoint's motor.  This is either a target angle or a target
+    Sets the target value for the HingeJoint's motor.  This is either a target angle or a target
     velocity, based on the mode set by `HingeJoint:setMotorMode`.
     velocity, based on the mode set by `HingeJoint:setMotorMode`.
   ]],
   ]],
-  arguments = {},
-  returns = {
+  arguments = {
     target = {
     target = {
       type = 'number',
       type = 'number',
       description = 'The target value, in radians or radians per second, depending on the mode.'
       description = 'The target value, in radians or radians per second, depending on the mode.'
     }
     }
   },
   },
+  returns = {},
   variants = {
   variants = {
     {
     {
-      arguments = {},
-      returns = { 'mode' }
+      arguments = { 'mode' },
+      returns = {}
     }
     }
   },
   },
   related = {
   related = {

+ 1 - 1
api/lovr/physics/Joint/getTorque.lua

@@ -25,6 +25,6 @@ return {
   ]],
   ]],
   related = {
   related = {
     'Joint:getTorque',
     'Joint:getTorque',
-    'HingeJoint:getMotorForce'
+    'HingeJoint:getMotorTorque'
   }
   }
 }
 }

+ 5 - 2
api/lovr/physics/SliderJoint/getAxis.lua

@@ -1,6 +1,6 @@
 return {
 return {
-  summary = 'Get the SliderJoint\'s axis.',
-  description = 'Returns the axis of the slider.',
+  summary = 'Get the axis of the SliderJoint.',
+  description = 'Returns the axis of the slider, in world space.',
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     x = {
     x = {
@@ -21,5 +21,8 @@ return {
       arguments = {},
       arguments = {},
       returns = { 'x', 'y', 'z' }
       returns = { 'x', 'y', 'z' }
     }
     }
+  },
+  related = {
+    'SliderJoint:getPosition'
   }
   }
 }
 }

+ 21 - 0
api/lovr/physics/SliderJoint/getFriction.lua

@@ -0,0 +1,21 @@
+return {
+  summary = 'Get the friction of the SliderJoint.',
+  description = [[
+    Returns the friction of the SliderJoint.  This is a maximum friction force that will be applied,
+    in newtons, opposing movement along the slider axis.
+  ]],
+  arguments = {},
+  returns = {
+    friction = {
+      type = 'number',
+      description = 'The maximum friction force, in newtons.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'friction' }
+    }
+  },
+  notes = 'Friction is only applied when the motor is disabled.'
+}

+ 13 - 12
api/lovr/physics/SliderJoint/getLimits.lua

@@ -1,28 +1,29 @@
 return {
 return {
-  summary = 'Get the SliderJoint\'s limits.',
-  description = 'Returns the upper and lower limits of the slider position.',
+  summary = 'Get the position limits of the SliderJoint.',
+  description = [[
+    Returns the position limits of the SliderJoint.  The "zero" position is determined by the
+    relative position of the colliders at the time the joint was created, and positive positions are
+    further apart along the slider axis.
+  ]],
   arguments = {},
   arguments = {},
   returns = {
   returns = {
-    lower = {
+    min = {
       type = 'number',
       type = 'number',
-      description = 'The lower limit.'
+      description = 'The minimum position, in meters.  Must be less than or equal to zero.'
     },
     },
-    upper = {
+    max = {
       type = 'number',
       type = 'number',
-      description = 'The upper limit.'
+      description = 'The maximum position, in meters.  Must be greater than or equal to zero.'
     }
     }
   },
   },
   variants = {
   variants = {
     {
     {
       arguments = {},
       arguments = {},
-      returns = { 'lower', 'upper' }
+      returns = { 'min', 'max' }
     }
     }
   },
   },
+  notes = 'The default limits are -math.huge and math.huge (no limits).',
   related = {
   related = {
-    'SliderJoint:getPosition',
-    'SliderJoint:getLowerLimit',
-    'SliderJoint:setLowerLimit',
-    'SliderJoint:getUpperLimit',
-    'SliderJoint:setUpperLimit'
+    'SliderJoint:getPosition'
   }
   }
 }
 }

+ 0 - 24
api/lovr/physics/SliderJoint/getLowerLimit.lua

@@ -1,24 +0,0 @@
-return {
-  summary = 'Get the SliderJoint\'s lower limit.',
-  description = 'Returns the lower limit of the slider position.',
-  arguments = {},
-  returns = {
-    limit = {
-      type = 'number',
-      description = 'The lower limit.'
-    }
-  },
-  variants = {
-    {
-      arguments = {},
-      returns = { 'limit' }
-    }
-  },
-  related = {
-    'SliderJoint:getPosition',
-    'SliderJoint:getUpperLimit',
-    'SliderJoint:setUpperLimit',
-    'SliderJoint:getLimits',
-    'SliderJoint:setLimits'
-  }
-}

+ 36 - 0
api/lovr/physics/SliderJoint/getMaxMotorForce.lua

@@ -0,0 +1,36 @@
+return {
+  summary = 'Get the maximum amount of force the motor can use.',
+  description = [[
+    Returns the maximum amount of force the motor can use to reach its target, in newtons.
+
+    There are separate limits for each direction the slider can move.  They're usually kept the
+    same, but one of them can be set to zero to make a motor that can only push in one direction.
+    Note that both limits are positive.
+  ]],
+  arguments = {},
+  returns = {
+    positive = {
+      type = 'number',
+      description = [[
+        The maximum amount of force the motor can use to push the slider in the "positive"
+        direction, in newtons.
+      ]]
+    },
+    negative = {
+      type = 'number',
+      description = [[
+        The maximum amount of force the motor can use to push the slider in the "negative"
+        direction, in newtons.
+      ]]
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'positive', 'negative' }
+    }
+  },
+  related = {
+    'SliderJoint:getMotorForce'
+  }
+}

+ 23 - 0
api/lovr/physics/SliderJoint/getMotorForce.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get the current motor force.',
+  description = [[
+    Returns the current force the motor is using to reach its target, in newtons.
+  ]],
+  arguments = {},
+  returns = {
+    force = {
+      type = 'number',
+      description = 'The current force, in newtons.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'force' }
+    }
+  },
+  related = {
+    'SliderJoint:getMaxMotorForce',
+    'SliderJoint:setMaxMotorForce'
+  }
+}

+ 25 - 0
api/lovr/physics/SliderJoint/getMotorMode.lua

@@ -0,0 +1,25 @@
+return {
+  summary = 'Get the motor mode of the SliderJoint.',
+  description = [[
+    Returns the motor mode of the SliderJoint.  When enabled, the motor will drive the slider to a
+    target position (for the `position` mode) or a target speed (for the `velocity` mode), set by
+    `SliderJoint:setMotorTarget`.
+  ]],
+  arguments = {},
+  returns = {
+    mode = {
+      type = 'MotorMode',
+      description = 'The mode of the motor, or `nil` if the motor is disabled.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'mode' }
+    }
+  },
+  related = {
+    'SliderJoint:getMotorTarget',
+    'SliderJoint:setMotorTarget'
+  }
+}

+ 36 - 0
api/lovr/physics/SliderJoint/getMotorSpring.lua

@@ -0,0 +1,36 @@
+return {
+  summary = 'Get the spring parameters of the motor target.',
+  description = [[
+    Returns the spring parameters of the motor target.  These are similar to the spring parameters
+    set by `SliderJoint:setSpring`, but they apply to the motor when it reaches its target instead
+    of the position limits of the slider joint.  Note that these only take effect when the motor
+    mode is `position`.
+  ]],
+  arguments = {},
+  returns = {
+    frequency = {
+      type = 'number',
+      description = [[
+        The frequency of the spring, in hertz.  Higher frequencies make the spring more stiff.  When
+        zero, the spring is disabled.
+      ]]
+    },
+    damping = {
+      type = 'number',
+      description = 'The damping ratio of the spring.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'frequency', 'damping' }
+    }
+  },
+  notes = 'See `SliderJoint:setSpring` for more detailed info on how the spring parameters work.',
+  related = {
+    'SliderJoint:getSpring',
+    'SliderJoint:setSpring',
+    'SliderJoint:getMotorTarget',
+    'SliderJoint:setMotorTarget'
+  }
+}

+ 24 - 0
api/lovr/physics/SliderJoint/getMotorTarget.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Get the target of the slider motor.',
+  description = [[
+    Returns the target value for the SliderJoint's motor.  This is either a target position or a
+    target velocity, based on the mode set by `SliderJoint:setMotorMode`.
+  ]],
+  arguments = {},
+  returns = {
+    target = {
+      type = 'number',
+      description = 'The target value, in meters or meters per second, depending on the mode.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'target' }
+    }
+  },
+  related = {
+    'SliderJoint:getMotorMode',
+    'SliderJoint:setMotorMode'
+  }
+}

+ 5 - 7
api/lovr/physics/SliderJoint/getPosition.lua

@@ -1,14 +1,15 @@
 return {
 return {
   summary = 'Get how far the SliderJoint is extended.',
   summary = 'Get how far the SliderJoint is extended.',
   description = [[
   description = [[
-    Returns how far the slider joint is extended (zero is the position the slider was created at,
-    positive values are further apart).
+    Returns the position of the slider joint.  The "zero" position is the relative distance the
+    colliders were at when the joint is created, and positive positions are further apart along the
+    slider's axis.
   ]],
   ]],
   arguments = {},
   arguments = {},
   returns = {
   returns = {
     position = {
     position = {
       type = 'number',
       type = 'number',
-      description = 'The joint position along its axis.'
+      description = 'The position of the slider joint, in meters.'
     }
     }
   },
   },
   variants = {
   variants = {
@@ -19,9 +20,6 @@ return {
   },
   },
   related = {
   related = {
     'SliderJoint:getAxis',
     'SliderJoint:getAxis',
-    'SliderJoint:getLowerLimit',
-    'SliderJoint:setLowerLimit',
-    'SliderJoint:getUpperLimit',
-    'SliderJoint:setUpperLimit'
+    'SliderJoint:setLimits'
   }
   }
 }
 }

+ 50 - 0
api/lovr/physics/SliderJoint/getSpring.lua

@@ -0,0 +1,50 @@
+return {
+  summary = 'Get the spring parameters of the SliderJoint limits.',
+  description = [[
+    Returns the spring parameters of the SliderJoint.  Use this to make the position limits of the
+    slider "soft".  When the motor is active, a separate set of spring parameters can be set on the
+    motor, see `SliderJoint:setMotorSpring`.
+  ]],
+  arguments = {},
+  returns = {
+    frequency = {
+      type = 'number',
+      description = [[
+        The frequency of the spring, in hertz.  Higher frequencies make the spring more stiff.  When
+        zero, the spring is disabled.
+      ]]
+    },
+    damping = {
+      type = 'number',
+      description = 'The damping ratio of the spring.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'frequency', 'damping' }
+    }
+  },
+  notes = [[
+    Higher frequencies make the spring more stiff.  When zero (the default), the spring is disabled
+    and the limits will be as stiff as possible.
+
+    The damping ratio controls how quickly the oscillation slows down:
+
+    - Undamped: Zero damping will cause the spring to oscillate forever.  (Note that the spring may
+      still lose a small amount of energy over time).
+    - Underdamped: Damping less than one results in a system that is underdamped.  The spring will
+      oscillate around the target, but the oscillations will decay over time, eventually stabilizing
+      at the target.
+    - Overdamped: Damping greater than one will not have any oscillation, and the spring will take
+      extra time to reach the target.
+    - Critical Damping: When the damping is exactly 1.0, there is no oscillation and the spring
+      takes the minimum amount of time to reach the target (based on the frequency).
+
+    The default damping ratio is zero.
+  ]],
+  related = {
+    'SliderJoint:getMotorSpring',
+    'SliderJoint:setMotorSpring'
+  }
+}

+ 0 - 24
api/lovr/physics/SliderJoint/getUpperLimit.lua

@@ -1,24 +0,0 @@
-return {
-  summary = 'Get the SliderJoint\'s upper limit.',
-  description = 'Returns the upper limit of the slider position.',
-  arguments = {},
-  returns = {
-    limit = {
-      type = 'number',
-      description = 'The upper limit.'
-    }
-  },
-  variants = {
-    {
-      arguments = {},
-      returns = { 'limit' }
-    }
-  },
-  related = {
-    'SliderJoint:getPosition',
-    'SliderJoint:getLowerLimit',
-    'SliderJoint:setLowerLimit',
-    'SliderJoint:getLimits',
-    'SliderJoint:setLimits'
-  }
-}

+ 0 - 35
api/lovr/physics/SliderJoint/setAxis.lua

@@ -1,35 +0,0 @@
-return {
-  summary = 'Set the SliderJoint\'s axis.',
-  description = 'Sets the axis of the slider.',
-  arguments = {
-    x = {
-      type = 'number',
-      description = 'The x component of the axis.'
-    },
-    y = {
-      type = 'number',
-      description = 'The y component of the axis.'
-    },
-    z = {
-      type = 'number',
-      description = 'The z component of the axis.'
-    },
-    axis = {
-      type = 'Vec3',
-      description = 'The axis.'
-    }
-  },
-  returns = {},
-  variants = {
-    {
-      description = 'Set the axis using numbers.',
-      arguments = { 'x', 'y', 'z' },
-      returns = {}
-    },
-    {
-      description = 'Set the axis using a vector.',
-      arguments = { 'axis' },
-      returns = {}
-    }
-  }
-}

+ 21 - 0
api/lovr/physics/SliderJoint/setFriction.lua

@@ -0,0 +1,21 @@
+return {
+  summary = 'Set the friction of the SliderJoint.',
+  description = [[
+    Sets the friction of the SliderJoint.  This is a maximum friction force that will be applied, in
+    newtons, opposing movement along the slider axis.
+  ]],
+  arguments = {
+    friction = {
+      type = 'number',
+      description = 'The maximum friction force, in newtons.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'friction' },
+      returns = {}
+    }
+  },
+  notes = 'Friction is only applied when the motor is disabled.'
+}

+ 18 - 12
api/lovr/physics/SliderJoint/setLimits.lua

@@ -1,28 +1,34 @@
 return {
 return {
-  summary = 'Set the SliderJoint\'s limits.',
-  description = 'Sets the upper and lower limits of the slider position.',
+  summary = 'Set the position limits of the SliderJoint.',
+  description = [[
+    Sets the position limits of the SliderJoint.  The "zero" position is determined by the relative
+    position of the colliders at the time the joint was created, and positive distances are further
+    apart on the slider axis.
+  ]],
   arguments = {
   arguments = {
-    lower = {
+    min = {
       type = 'number',
       type = 'number',
-      description = 'The lower limit.'
+      description = 'The minimum position, in meters.  Must be less than or equal to zero.'
     },
     },
-    upper = {
+    max = {
       type = 'number',
       type = 'number',
-      description = 'The upper limit.'
+      description = 'The maximum position, in meters.  Must be greater than or equal to zero.'
     }
     }
   },
   },
   returns = {},
   returns = {},
   variants = {
   variants = {
     {
     {
-      arguments = { 'lower', 'upper' },
+      arguments = { 'min', 'max' },
+      returns = {}
+    },
+    {
+      description = 'Disable the limits, setting them to -math.huge and math.huge.',
+      arguments = {},
       returns = {}
       returns = {}
     }
     }
   },
   },
+  notes = 'The default limits are -math.huge and math.huge.',
   related = {
   related = {
-    'SliderJoint:getPosition',
-    'SliderJoint:getLowerLimit',
-    'SliderJoint:setLowerLimit',
-    'SliderJoint:getUpperLimit',
-    'SliderJoint:setUpperLimit'
+    'SliderJoint:getPosition'
   }
   }
 }
 }

+ 0 - 24
api/lovr/physics/SliderJoint/setLowerLimit.lua

@@ -1,24 +0,0 @@
-return {
-  summary = 'Set the SliderJoint\'s lower limit.',
-  description = 'Sets the lower limit of the slider position.',
-  arguments = {
-    limit = {
-      type = 'number',
-      description = 'The lower limit.'
-    }
-  },
-  returns = {},
-  variants = {
-    {
-      arguments = { 'limit' },
-      returns = {}
-    }
-  },
-  related = {
-    'SliderJoint:getPosition',
-    'SliderJoint:getUpperLimit',
-    'SliderJoint:setUpperLimit',
-    'SliderJoint:getLimits',
-    'SliderJoint:setLimits'
-  }
-}

+ 38 - 0
api/lovr/physics/SliderJoint/setMaxMotorForce.lua

@@ -0,0 +1,38 @@
+return {
+  summary = 'Set the maximum amount of force the motor can use.',
+  description = [[
+    Sets the maximum amount of force the motor can use to reach its target, in newtons.
+
+    There are separate limits for each direction the slider can move.  They're usually kept the
+    same, but one of them can be set to zero to make a motor that can only push in one direction.
+    Note that both limits are positive.
+  ]],
+  arguments = {
+    positive = {
+      type = 'number',
+      default = 'math.huge',
+      description = [[
+        The maximum amount of force the motor can use to push the slider in the "positive"
+        direction, in newtons.
+      ]]
+    },
+    negative = {
+      type = 'number',
+      default = 'positive',
+      description = [[
+        The maximum amount of force the motor can use to push the slider in the "negative"
+        direction, in newtons.
+      ]]
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = {},
+      returns = { 'positive', 'negative' }
+    }
+  },
+  related = {
+    'SliderJoint:getMotorForce'
+  }
+}

+ 30 - 0
api/lovr/physics/SliderJoint/setMotorMode.lua

@@ -0,0 +1,30 @@
+return {
+  summary = 'Set the motor mode of the SliderJoint.',
+  description = [[
+    Sets the motor mode of the SliderJoint.  When enabled, the motor will drive the slider to a
+    target position (for the `position` mode) or a target speed (for the `velocity` mode), set by
+    `SliderJoint:setMotorTarget`.
+  ]],
+  arguments = {
+    mode = {
+      type = 'MotorMode',
+      description = 'The mode of the motor.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'mode' },
+      returns = {}
+    },
+    {
+      description = 'Disables the motor.',
+      arguments = {},
+      returns = {}
+    }
+  },
+  related = {
+    'SliderJoint:getMotorTarget',
+    'SliderJoint:setMotorTarget'
+  }
+}

+ 38 - 0
api/lovr/physics/SliderJoint/setMotorSpring.lua

@@ -0,0 +1,38 @@
+return {
+  summary = 'Set the spring parameters of the motor target.',
+  description = [[
+    Sets the spring parameters of the motor target.  These are similar to the spring parameters set
+    by `SldierJoint:setSpring`, but they apply to the motor when it reaches its target instead of
+    the position limits of the slider joint.  Note that these only take effect when the motor mode
+    is `position`.
+  ]],
+  arguments = {
+    frequency = {
+      type = 'number',
+      default = '0.0',
+      description = [[
+        The frequency of the spring, in hertz.  Higher frequencies make the spring more stiff.  When
+        zero, the spring is disabled.
+      ]]
+    },
+    damping = {
+      type = 'number',
+      default = '1.0',
+      description = 'The damping ratio of the spring.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'frequency', 'damping' },
+      returns = {}
+    }
+  },
+  notes = 'See `SldierJoint:setSpring` for more detailed info on how the spring parameters work.',
+  related = {
+    'SliderJoint:getSpring',
+    'SliderJoint:setSpring',
+    'SliderJoint:getMotorTarget',
+    'SliderJoint:setMotorTarget'
+  }
+}

+ 24 - 0
api/lovr/physics/SliderJoint/setMotorTarget.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Set the target of the slider motor.',
+  description = [[
+    Sets the target value for the SliderJoint's motor.  This is either a target position or a target
+    velocity, based on the mode set by `SliderJoint:setMotorMode`.
+  ]],
+  arguments = {
+    target = {
+      type = 'number',
+      description = 'The target value, in meters or meters per second, depending on the mode.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'mode' },
+      returns = {}
+    }
+  },
+  related = {
+    'SliderJoint:getMotorMode',
+    'SliderJoint:setMotorMode'
+  }
+}

+ 52 - 0
api/lovr/physics/SliderJoint/setSpring.lua

@@ -0,0 +1,52 @@
+return {
+  summary = 'Set the spring parameters of the SliderJoint limits.',
+  description = [[
+    Sets the spring parameters of the SliderJoint.  Use this to make the position limits of the
+    slider "soft".  When the motor is active, a separate set of spring parameters can be set on the
+    motor, see `SliderJoint:setMotorSpring`.
+  ]],
+  arguments = {
+    frequency = {
+      type = 'number',
+      default = '0.0',
+      description = [[
+        The frequency of the spring, in hertz.  Higher frequencies make the spring more stiff.  When
+        zero, the spring is disabled.
+      ]]
+    },
+    damping = {
+      type = 'number',
+      default = '1.0',
+      description = 'The damping ratio of the spring.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'frequency', 'damping' },
+      returns = {}
+    }
+  },
+  notes = [[
+    Higher frequencies make the spring more stiff.  When zero (the default), the spring is disabled
+    and the limits will be as stiff as possible.
+
+    The damping ratio controls how quickly the oscillation slows down:
+
+    - Undamped: Zero damping will cause the spring to oscillate forever.  (Note that the spring may
+      still lose a small amount of energy over time).
+    - Underdamped: Damping less than one results in a system that is underdamped.  The spring will
+      oscillate around the target, but the oscillations will decay over time, eventually stabilizing
+      at the target.
+    - Overdamped: Damping greater than one will not have any oscillation, and the spring will take
+      extra time to reach the target.
+    - Critical Damping: When the damping is exactly 1.0, there is no oscillation and the spring
+      takes the minimum amount of time to reach the target (based on the frequency).
+
+    The default damping ratio is zero.
+  ]],
+  related = {
+    'SliderJoint:getMotorSpring',
+    'SliderJoint:setMotorSpring'
+  }
+}

+ 0 - 24
api/lovr/physics/SliderJoint/setUpperLimit.lua

@@ -1,24 +0,0 @@
-return {
-  summary = 'Set the SliderJoint\'s upper limit.',
-  description = 'Sets the upper limit of the slider position.',
-  arguments = {
-    limit = {
-      type = 'number',
-      description = 'The upper limit.'
-    }
-  },
-  returns = {},
-  variants = {
-    {
-      arguments = { 'limit' },
-      returns = {}
-    }
-  },
-  related = {
-    'SliderJoint:getPosition',
-    'SliderJoint:getLowerLimit',
-    'SliderJoint:setLowerLimit',
-    'SliderJoint:getLimits',
-    'SliderJoint:setLimits'
-  }
-}