Help rotating the camera with my player

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
n1c
Prole
Posts: 2
Joined: Tue Dec 02, 2014 10:00 am

Help rotating the camera with my player

Post by n1c »

Hey guys!

I've looked around (viewtopic.php?f=4&t=78216, https://github.com/kikito/gamera) but really can't figure out just where I'm going wrong when trying to rotate the camera so my player always faces "up" in my little game.

The code can be found here - https://github.com/n1c/dash as far as I can tell I should be setting the rotation here https://github.com/n1c/dash/blob/master/game.lua#L41 based on the player's angle in the world. Though that seems wrong in practice.

Any insight would be greatly appreciated! Gamedev is new to me and it's been quite a while since doing trig so I feel so in the dark! :awesome:
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Help rotating the camera with my player

Post by kikito »

Hi there,

You are not using gamera, but BlackBulletIV's camera

I might be wrong, but probably your control scheme (which makes the player "look at" the mouse) is not compatible with "rotating the camera to where the player is looking at". This is because BlackBulletIV's code does not take into account the camera's rotation when returning the mouse coordinates.

gamera does take this into account, so it might help you with that (hump's camera also does it). However your control scheme will still not be compatible with it - you will need to "gradually adjust the roation of the camera so that it matches the player angle", not "set it to the player angle". Otherwise it will be too abrupt.
When I write def I mean function.
n1c
Prole
Posts: 2
Joined: Tue Dec 02, 2014 10:00 am

Re: Help rotating the camera with my player

Post by n1c »

Yeah the linked code uses BlackBulletIV's lib, I should have explained a bit that I'd also tried out gamera but hadn't made any useful progress.

Thanks for the reply. I'll look in to the control scheme you mention!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot] and 6 guests