Browse Source

Write docs for WeldJoint page and remove anchor;

bjorn 1 year ago
parent
commit
c3967d0453
3 changed files with 19 additions and 67 deletions
  1. 5 43
      api/init.lua
  2. 13 3
      api/lovr/physics/WeldJoint/init.lua
  3. 1 21
      api/lovr/physics/newWeldJoint.lua

+ 5 - 43
api/init.lua

@@ -33437,47 +33437,6 @@ return {
                   name = "colliderB",
                   name = "colliderB",
                   type = "Collider",
                   type = "Collider",
                   description = "The second collider to attach the Joint to."
                   description = "The second collider to attach the Joint to."
-                },
-                {
-                  name = "x",
-                  type = "number",
-                  description = "The x position of the anchor point, in world coordinates."
-                },
-                {
-                  name = "y",
-                  type = "number",
-                  description = "The y position of the anchor point, in world coordinates."
-                },
-                {
-                  name = "z",
-                  type = "number",
-                  description = "The z position of the anchor point, in world coordinates."
-                }
-              },
-              returns = {
-                {
-                  name = "joint",
-                  type = "WeldJoint",
-                  description = "The new WeldJoint."
-                }
-              }
-            },
-            {
-              arguments = {
-                {
-                  name = "colliderA",
-                  type = "Collider",
-                  description = "The first collider to attach the Joint to, or `nil` to attach the joint to a fixed position in the World."
-                },
-                {
-                  name = "colliderB",
-                  type = "Collider",
-                  description = "The second collider to attach the Joint to."
-                },
-                {
-                  name = "anchor",
-                  type = "Vec3",
-                  description = "The anchor point, in world coordinates."
                 }
                 }
               },
               },
               returns = {
               returns = {
@@ -39355,10 +39314,13 @@ return {
         },
         },
         {
         {
           name = "WeldJoint",
           name = "WeldJoint",
-          summary = "TODO",
-          description = "TODO",
+          summary = "A joint that welds two colliders together.",
+          description = "A WeldJoint is a `Joint` that restricts all relative motion between two colliders, as though they were welded together into a single object.  All six degrees of freedom are constrained.\n\nWeldJoints are useful for making breakable objects.  Several colliders can be welded together with joints, and if `Joint:getForce` reports a large enough value, the joints can be disabled or destroyed, allowing the pieces to move freely.",
           key = "WeldJoint",
           key = "WeldJoint",
           module = "lovr.physics",
           module = "lovr.physics",
+          constructors = {
+            "lovr.physics.newWeldJoint"
+          },
           extends = "Joint",
           extends = "Joint",
           methods = {}
           methods = {}
         },
         },

+ 13 - 3
api/lovr/physics/WeldJoint/init.lua

@@ -1,5 +1,15 @@
 return {
 return {
-  summary = 'TODO',
-  description = 'TODO',
-  extends = 'Joint'
+  summary = 'A joint that welds two colliders together.',
+  description = [[
+    A WeldJoint is a `Joint` that restricts all relative motion between two colliders, as though
+    they were welded together into a single object.  All six degrees of freedom are constrained.
+
+    WeldJoints are useful for making breakable objects.  Several colliders can be welded together
+    with joints, and if `Joint:getForce` reports a large enough value, the joints can be disabled or
+    destroyed, allowing the pieces to move freely.
+  ]],
+  extends = 'Joint',
+  constructors = {
+    'lovr.physics.newWeldJoint'
+  }
 }
 }

+ 1 - 21
api/lovr/physics/newWeldJoint.lua

@@ -13,22 +13,6 @@ return {
     colliderB = {
     colliderB = {
       type = 'Collider',
       type = 'Collider',
       description = 'The second collider to attach the Joint to.'
       description = 'The second collider to attach the Joint to.'
-    },
-    x = {
-      type = 'number',
-      description = 'The x position of the anchor point, in world coordinates.'
-    },
-    y = {
-      type = 'number',
-      description = 'The y position of the anchor point, in world coordinates.'
-    },
-    z = {
-      type = 'number',
-      description = 'The z position of the anchor point, in world coordinates.'
-    },
-    anchor = {
-      type = 'Vec3',
-      description = 'The anchor point, in world coordinates.'
     }
     }
   },
   },
   returns = {
   returns = {
@@ -39,11 +23,7 @@ return {
   },
   },
   variants = {
   variants = {
     {
     {
-      arguments = { 'colliderA', 'colliderB', 'x', 'y', 'z' },
-      returns = { 'joint' }
-    },
-    {
-      arguments = { 'colliderA', 'colliderB', 'anchor' },
+      arguments = { 'colliderA', 'colliderB' },
       returns = { 'joint' }
       returns = { 'joint' }
     }
     }
   },
   },