Closed Snuux closed 11 years ago
I think your issue is that the "bottom right" corner changes position when you rotate the shape:
It is not always at xs+16, ys+16
, but also depends on the current rotation of the shape.
You can probably work something out using hump.vector or the bundled hump.vector-light, e.g.
vector = require 'res.lib.hardoncollider.vector-light'
(...)
xs, ys = ball:center()
brx, bry = vector.add(xs, ys, vector.rotate(ball.angle, 16,16))
ball.angle = math.atan2(my-ys, mx-ys) -- SIC: atan2 has argument order y,x!
(...)
Anyway, since this issue is not a bug in the library you should ask further questions in the love forums. You also will probably be able to get a faster response this way.
I want to rotate ball shape by ball.angle like ox, oy:
My code:
I try this code, but... I don't know where mistake... Please help! Thanks!)