I realized the love framework always based on point 0,0
Imagine I loaded arrow up image and rotate 30 degree, the rotation point suppose to based on the bottom of the img and not 0, 0 of the img
How to rotate an img based on a reference point?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How to rotate an img based on a reference point?
Look at http://love2d.org/wiki/love.graphics.draw
The last two parameters, ox and oy are the origin offset, around that point are images rotated.
When in doubt, read the wiki.
The last two parameters, ox and oy are the origin offset, around that point are images rotated.
When in doubt, read the wiki.
Help us help you: attach a .love.
Re: How to rotate an img based on a reference point?
Then there's doing it manually...
If that doesn't work, blame my sugar rush from just drinking a LOT of pepsi.
Code: Select all
local angle;
local x,y;
local ox,oy;
local a,b=math.sin(angle),math.cos(angle) --Trig ftw.
local rx,ry=x+a*ox,y+a*oy;
Hello, I am not dead.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How to rotate an img based on a reference point?
zac, please don't do that.
weilies: you can ignore zac's post.
weilies: you can ignore zac's post.
Help us help you: attach a .love.
Re: How to rotate an img based on a reference point?
I'm sowwy.Robin wrote:zac, please don't do that.
weilies: you can ignore zac's post.
I couldn't help it.
Hello, I am not dead.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests