Physics Image Support?
Posted: Sat Jan 08, 2011 8:53 pm
Is there a way to have image support for love.physics at the moment? I couldn't find anything on the wiki, but do any of you know a workaround?
Code: Select all
width = 64
height = 48
body = love.physics.newBody(world, x, y)
shape = love.physics.newRectangleShape(body, 0, 0, width, height )
love.graphics.rectangle("fill", body:getX() - (width/ 2), body:getY() - (height / 2), body:getX() + (width/ 2), body:getY() + (height / 2))
http://love2d.org/wiki/love.graphics.rotatetentus wrote:It cannot show you the angle, it just isn't a part of the love.graphics.rectangle function. To do that you will need to make an image (or generate it in Love) and use getAngle() to draw it at the right orientation.
I honestly forgot about that one, because I never use it. (I dislike having to store a value, call a function, call the function I originally wanted, and then call a function again with the stored value... it feels like four times the work that simply having an extra parameter in the original function would solve.)TechnoCat wrote:http://love2d.org/wiki/love.graphics.rotatetentus wrote:It cannot show you the angle, it just isn't a part of the love.graphics.rectangle function. To do that you will need to make an image (or generate it in Love) and use getAngle() to draw it at the right orientation.
Store a value? push/pop seems like a better fit, especially if you have more transformations going on at the same time.tentus wrote:I honestly forgot about that one, because I never use it. (I dislike having to store a value, call a function, call the function I originally wanted, and then call a function again with the stored value... it feels like four times the work that simply having an extra parameter in the original function would solve.)
It is mostly useful as a different "context", that is if you need to draw more than one object transformed, for example if the whole world rotates, except for the HUD.tentus wrote:I had alpha on my mind when I wrote that, so I didn't even consider push/pop, I should have. Still, that's three lines of code for what could be one.