- Home /
Camera Pan
Hi, all! I have devised a method of checking if m player ship has pushed to one of the boundaries of the camera, and if it has then tweening the camera to the appropriate spot.
I feel as if my logic is either screwed up, or my coding knowledge is bad. When I tried to code it it came out so that I would check for one condition, and then inside it I would have to check for all other conditions separately for each instance of a condition -_-
I am not thrilled at this notion.
Does anyone have a more brilliant way of implementing this? I will add an illustration to better show what I'm trying to achieve.
Thanks! - YA
This is what I have for a spreadsheet. It's nigh impossible to read, so I really think I'm going about this the wrong way.
And here is a demonstration of what I'm trying to do:
Answer by MountDoomTeam · Mar 18, 2013 at 12:17 AM
so you you know how to get the position of an object relative to the screen boundaries? I have done lately but basically can get screentopoint or some kind of similar command that will give you easy control of any object relative to the screen position.
Once you have that, it is very easy.
He put a functioning update which says: IF player object close to screen boundary, THEN slowly rotate camera towards player. research unity answers for smooth look at, and lerp rotate towards before the actual camera movement, and apply the movements for a time period after the player has reached the edge of the screen, until long enough that the camera has turned to, and then switch off the smooth look at.