Game Development Community

What are the units for Camera Width & Height in the Torque X Builder 2D?

by Matt Simpson · in Torque X 2D · 02/24/2010 (10:22 am) · 6 replies

This might be a stupid question (apologies if so) but what are the units for the Camera Width and Height in the Torque X Builder 2D?

The default values seem to be 100 for Width and 75 for Height, but what do these numbers represent?

#1
02/24/2010 (11:04 am)
From John's book, "The Complete Guide to Torque X," it's "the width and height of the area in the world that fit into the camera’s field of view and show up on the screen."

Although the units aren't pixels, they're like Torque units which do effect how much you're actually viewing... (someone else may have more detail on this).

Note that the aspect ratio of the width and height should match the aspect ratio of the screen.
#2
02/24/2010 (11:30 am)
Basically you can set the Camera width/height to whatever you like. What it does is allow you to work in units independent of the screen resolution the game happens to run in (useful if your game might run in multiple resolutions - such as on PC).

If you're working on xbox or with a fixed resolution then you may find it useful to make the camera units the same as the target screen resolution, but it's not essential. As Josh noted though, you'd normally keep the aspect ratio at least.
#3
02/24/2010 (11:59 am)
For the xbox I usually set my camera to 128x72, then everything seems to work out great. Dont forget to set Design resolution to 1280x720 in the preferences. If you are building for the PC then set it to whatever your final output resolution will be.

#4
02/24/2010 (12:04 pm)
Just an FYI you set the resolution in the file torqueSettings.xml with the below settings:

<PreferredBackBufferHeight>720</PreferredBackBufferHeight>
<PreferredBackBufferWidth>1280</PreferredBackBufferWidth>

#5
02/26/2010 (9:17 am)
Hey guys, thanks for your comments.

I understand how to set the resolution to 720p using the torqueSettings.xml file.

I'm still not clear on what the camera settings do to be honest but I'll have a play around and see if I can get it clear in my mind.
#6
02/26/2010 (11:11 pm)
They are really arbitrary. For example, if you're making a space game you could consider them space coordinates and decide that you want the player to be able to see x number of coordinates across the screen and y number up and down the screen.

For another game each value could be a meter so 128x78 means the player can see 128x78 meters on the screen regardless of the screen resolution. Everything else would scale accordingly. If your player moves 1 meter per second then he will move 1/128 of the way across the screen regardless of the screen resolution.

It took me a while to grasp, but it works really well. Decide what you want it to be and then how much of it should be shown on the screen. It then makes your sizes and movements completely independent of the resolution the user uses.