Relative camera limits?
by Teck Lee Tan · in Torque Game Builder · 03/30/2005 (3:37 pm) · 2 replies
I was going to post this in the Moving the camera thread, but figured this was different enough to warrant a separate topic. Currently we can setup the camera with world limits, but what if I wanted to have those limits relative to the player's position, for example? What I have in mind is keyboard-controlled movement,and mouse controlled viewing/aiming, a la Cannon Fodder. If I recall correctly, the camera was loosely tied to the mouse cursorin that game, but for obvious reasons wouldn't be able to go too far (ie, far enough that the player was no longer in view).
As I was typing this up, I thought of a way to do this, although it'd be ugly. Basically my thinking is to have a few collision shapes defining a rectangle (or octagon, etc) around the player. The aiming reticule, which will be tied to the mouse position, which would be set to collide with this boundary. The camera would be mounted to said reticule. Yeah, that should work, I think.
If there's a cleaner way to do this, feel free to chip in. :) Melv, if you can possibly add relative camera limits, that would be great, too. :)
As I was typing this up, I thought of a way to do this, although it'd be ugly. Basically my thinking is to have a few collision shapes defining a rectangle (or octagon, etc) around the player. The aiming reticule, which will be tied to the mouse position, which would be set to collide with this boundary. The camera would be mounted to said reticule. Yeah, that should work, I think.
If there's a cleaner way to do this, feel free to chip in. :) Melv, if you can possibly add relative camera limits, that would be great, too. :)
#2
I'm not quite sure how that didn't occur to me. :-p
03/31/2005 (5:34 am)
Quote:Could you not change it when the player moves or simply adjust it in the per-frame callback?Duh! *slaps forehead*
I'm not quite sure how that didn't occur to me. :-p
Employee Melv May
I'll have a think about how to best do it inside T2D. My problem always is trying not to have too many functions seemingly doing the same thing.
I have added it to the "NICETO" list. :)
- Melv.