Hello everyone, I'm new to Löve (and game development in general), and I'm having some trouble understanding the camera concept properly. Without having some previous knowledge, making one on my own seemed way too complex, so I've searched the wiki and found this. I still couldn't quite understand how everything works, but eventually I've got around it... except for camera rotation.
The rotation is working, but from the topleft corner. My guess is that I need a lg.translante(...) somewhere.
Any idea on how to solve it? I'm a bit lost right now.
Also, if anyone knows a tutorial/explanation on this subject(should I call it 'screen transformation'?), it'd be greatly appreciated.
How to properly rotate the camera
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How to properly rotate the camera
- Attachments
-
- shmup.love
- (66.25 KiB) Downloaded 143 times
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: How to properly rotate the camera
The trick to having rotation (or scale, or shear, etc) applied at a particular pointing is first translating to the point, then doing the operation, then translating back. So in this case love.graphics.translate(x, y), followed by love.graphics.rotate(angle), followed by love.graphics.translate(-x, -y).
- Sheepolution
- Party member
- Posts: 264
- Joined: Mon Mar 04, 2013 9:31 am
- Location: The Netherlands
- Contact:
Re: How to properly rotate the camera
Check out the library gamera
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests