Browse Source

Shape:isSensor; Shape:setSensor;

bjorn 5 years ago
parent
commit
94d54a8f17
3 changed files with 68 additions and 0 deletions
  1. 38 0
      api/init.lua
  2. 15 0
      api/lovr/physics/Shape/isSensor.lua
  3. 15 0
      api/lovr/physics/Shape/setSensor.lua

+ 38 - 0
api/init.lua

@@ -21435,6 +21435,25 @@ return {
                 }
                 }
               }
               }
             },
             },
+            {
+              name = "isSensor",
+              summary = "Check if the Shape is a sensor.",
+              description = "Returns whether the Shape is a sensor.  Sensors do not trigger any collision response, but they still report collisions in `World:collide`.",
+              key = "Shape:isSensor",
+              module = "lovr.physics",
+              variants = {
+                {
+                  arguments = {},
+                  returns = {
+                    {
+                      name = "sensor",
+                      type = "boolean",
+                      description = "Whether the Shape is a sensor."
+                    }
+                  }
+                }
+              }
+            },
             {
             {
               name = "setEnabled",
               name = "setEnabled",
               summary = "Enable or disable the Shape.",
               summary = "Enable or disable the Shape.",
@@ -21526,6 +21545,25 @@ return {
                 }
                 }
               }
               }
             },
             },
+            {
+              name = "setSensor",
+              summary = "Set the sensor status for the Shape.",
+              description = "Sets whether this Shape is a sensor.  Sensors do not trigger any collision response, but they still report collisions in `World:collide`.",
+              key = "Shape:setSensor",
+              module = "lovr.physics",
+              variants = {
+                {
+                  arguments = {
+                    {
+                      name = "sensor",
+                      type = "boolean",
+                      description = "Whether the Shape should be a sensor."
+                    }
+                  },
+                  returns = {}
+                }
+              }
+            },
             {
             {
               name = "setUserData",
               name = "setUserData",
               summary = "Set the Shape's user data.",
               summary = "Set the Shape's user data.",

+ 15 - 0
api/lovr/physics/Shape/isSensor.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Check if the Shape is a sensor.',
+  description = [[
+    Returns whether the Shape is a sensor.  Sensors do not trigger any collision response, but they
+    still report collisions in `World:collide`.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'sensor',
+      type = 'boolean',
+      description = 'Whether the Shape is a sensor.'
+    }
+  }
+}

+ 15 - 0
api/lovr/physics/Shape/setSensor.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Set the sensor status for the Shape.',
+  description = [[
+    Sets whether this Shape is a sensor.  Sensors do not trigger any collision response, but they
+    still report collisions in `World:collide`.
+  ]],
+  arguments = {
+    {
+      name = 'sensor',
+      type = 'boolean',
+      description = 'Whether the Shape should be a sensor.'
+    }
+  },
+  returns = {}
+}