We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › "Camera" follow in 2d mode
Page Index Toggle Pages: 1
"Camera" follow in 2d mode? (Read 340 times)
"Camera" follow in 2d mode?
Jan 30th, 2009, 3:07am
 
Hello,
I've been trying to figure out how to make a camera follow my objects in 2D space.  Not really sure how to approach it on a conceptual level.

Specifically, I've got a bunch of objects in an array moving about according to points determined by the mouseclick on the screen using push/pop matrix and translate.  So my goal with this project is to have the objects moving about independently (the clicking was just a sort of "okay, I'm at this stage type thing").

With the camera, my issue is: how does the coordinate system work then?  If the coordinates are determined by the pixels on the initial 640x480 screen, then how would a camera determinte "itself," so to speak...?  Wouldn't I have to modify the objects themselves in relation to where I believe the camera should be, eg: expanding/contracting the elipses to simulate zoom, reducing speed/trajectory to simulate panning, etc?


Anyway, my goal: as the objects move about and converge independently, I would like to have a camera "following" them with varying degrees of lag and zooming and whatnot...

Is there a way to do this in actuality, or would I have to simulate it within the movement functions of the objects themselves?

This is the "sketch" so far... http://openprocessing.org/visuals/?visualID=930
There's nothing re: a camera in here, but it'll give you an idea of where I am/what my goal is... hopefully.
I'm very, very new to processing and this is all I've managed to come up with so far inbetween school work, which is unfortunately poli sci oriented.

Many thanks!
Re: "Camera" follow in 2d mode?
Reply #1 - Jan 30th, 2009, 11:19pm
 
this tutorial:
http://www.donhavey.com/blog/tutorials/reverse-engineered-metamorphosis/

has some code in it for a 'following' camera. zooming is a different matter though, not sure if that is referenced at all. this isn't mine btw, i just happen to have it bookmarked for future reference.
Page Index Toggle Pages: 1