vrld / HC

General purpose collision detection library for the use with LÖVE.
http://hc.readthedocs.org/
404 stars 48 forks source link

Unable to rotate polygon #28

Closed italomaia closed 10 years ago

italomaia commented 10 years ago

Just made a polygon using shapes.newPolygonShape, extended it using 30log + CC, instantiated it and then tried to rotate it but the polygon doesn't rotate.

Example:

pol = shapes.newPolygonShape(
     0, 10,
    10,  0,
    48,  0, 
    58, 10, 
    58, 30, 
    48, 40,
    10, 40,
     0, 30
  )

car = common.class('car', {}, pol)
myCar = common.instance(car)
myCar:rotate(math.pi/4) -- does not do a thing
italomaia commented 10 years ago

Ok, just pinned the problem. I can't rotate my polygon if I require 30logclasscommons before requiring "hardoncollider.shapes". This probably has something to do with the use of 30log CC implementation. No ideia if this is a problem related to 30log or HC.

italomaia commented 10 years ago

More on this issue: I tried testing another OO library with hardon, slither. The result? No result, actually. I get an error. So, I went back to trace down the reason for 30log and HC "no rotate" behavior. Placing a print inside polygon:rotate and shape:rotate, I discovered that when using 30log, polygon:rotate is never called. If 30log is not present, shape and polygon rotate methods are called. Here is my test code:

http://dpaste.com/hold/1526867/

italomaia commented 10 years ago

Fixed on 30log side.

vrld commented 10 years ago

Just for completeness, and to clarify some things about class commons: