PhysicsJoint.lua 471 B

12345678910111213141516171819202122232425262728
  1. class "PhysicsJoint"
  2. function PhysicsJoint:PhysicsJoint(...)
  3. for k,v in pairs(arg) do
  4. if type(v) == "table" then
  5. if v.__ptr ~= nil then
  6. arg[k] = v.__ptr
  7. end
  8. end
  9. end
  10. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  11. self.__ptr = Physics2D.PhysicsJoint(unpack(arg))
  12. Polycore.__ptr_lookup[self.__ptr] = self
  13. end
  14. end
  15. function PhysicsJoint:__delete()
  16. Polycore.__ptr_lookup[self.__ptr] = nil
  17. Physics2D.delete_PhysicsJoint(self.__ptr)
  18. end