Browse Source

newWeldJoint;

bjorn 1 year ago
parent
commit
af6c0cb6e0
2 changed files with 138 additions and 0 deletions
  1. 80 0
      api/init.lua
  2. 58 0
      api/lovr/physics/newWeldJoint.lua

+ 80 - 0
api/init.lua

@@ -33310,6 +33310,86 @@ return {
             }
           }
         },
+        {
+          name = "newWeldJoint",
+          tag = "joints",
+          summary = "Create a new WeldJoint.",
+          description = "Creates a new WeldJoint.",
+          key = "lovr.physics.newWeldJoint",
+          module = "lovr.physics",
+          notes = "The joint will try to keep the Colliders in the relative pose they were at when the joint was created.",
+          related = {
+            "lovr.physics.newBallJoint",
+            "lovr.physics.newConeJoint",
+            "lovr.physics.newDistanceJoint",
+            "lovr.physics.newHingeJoint",
+            "lovr.physics.newSliderJoint"
+          },
+          variants = {
+            {
+              arguments = {
+                {
+                  name = "colliderA",
+                  type = "Collider",
+                  description = "The first collider to attach the Joint to."
+                },
+                {
+                  name = "colliderB",
+                  type = "Collider",
+                  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."
+                },
+                {
+                  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 = {
+                {
+                  name = "joint",
+                  type = "WeldJoint",
+                  description = "The new WeldJoint."
+                }
+              }
+            }
+          }
+        },
         {
           name = "newWorld",
           tag = "world",

+ 58 - 0
api/lovr/physics/newWeldJoint.lua

@@ -0,0 +1,58 @@
+return {
+  tag = 'joints',
+  summary = 'Create a new WeldJoint.',
+  description = 'Creates a new WeldJoint.',
+  arguments = {
+    colliderA = {
+      type = 'Collider',
+      description = 'The first collider to attach the Joint to.'
+    },
+    colliderB = {
+      type = 'Collider',
+      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 = {
+    joint = {
+      type = 'WeldJoint',
+      description = 'The new WeldJoint.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'colliderA', 'colliderB', 'x', 'y', 'z' },
+      returns = { 'joint' }
+    },
+    {
+      arguments = { 'colliderA', 'colliderB', 'anchor' },
+      returns = { 'joint' }
+    }
+  },
+  notes = [[
+    The joint will try to keep the Colliders in the relative pose they were at when the joint was
+    created.
+  ]],
+  related = {
+    'lovr.physics.newBallJoint',
+    'lovr.physics.newConeJoint',
+    'lovr.physics.newDistanceJoint',
+    'lovr.physics.newHingeJoint',
+    'lovr.physics.newSliderJoint'
+  }
+}