From 3275ae4948fd2c1bb8da780214cbb741dc3178be Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 12 May 2023 01:16:46 -0500 Subject: begin refactor --- honey/ode.lua | 55 ------------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 honey/ode.lua (limited to 'honey/ode.lua') diff --git a/honey/ode.lua b/honey/ode.lua deleted file mode 100644 index 4cd2e54..0000000 --- a/honey/ode.lua +++ /dev/null @@ -1,55 +0,0 @@ -local module = {} -setmetatable(module, {__index=_G} -setfenv(1, module) - - ---===== collision =====-- - -Geom = {} -Geom.__index = Geom - - -function Geom.new(_, type, params) - local self = {} - self.type = type - self.params = params - setmetatable(self, Geom) - return self -end -setmetatable(Geom, {__call=Geom.new}) - - -function Geom.renew(geom) - return ode.GeomGetData(geom) -end - - -local function instantiateSphere(space, params) - local geom = ode.CreateSphere(space, params.radius) - return geom -end - - -local function instantiatePlane(space, params) - local geom = ode.CreatePlane(space, params.a, params.b, params.c, params.d) - return geom -end - - -function Geom.instantiate(self, space) - if self.type == "sphere" then - self.geom = instantiateSphere(space, self.params) - elseif self.type == "plane" then - self.geom = instantiatePlane(space, self.params) - else - error(string.format("bad geom type: %s", self.type)) - end - ode.GeomSetData(self.geom, self) - return self -end - - -function Geom.setBody(self, body) - ode.GeomSetBody(self.geom, body.body) - return self -end -- cgit v1.2.1