Isometric Camera
by Javier Canon · 10/02/2009 (11:06 pm) · 6 comments
Many forum post of isometric camera, make this, make these, bla bla bla, but no resources... so i make this for easy find one...

INSTRUCTIONS STANDARD CAMERA
_______________________________
I'm not a Torque networking expert, but i think that the standard camera its better for multiplayer games that the advanced camera.
1. Replace in function GameConnection::createPlayer(%this, %spawnPoint)
with
( TGEA AND T3D )
Tip: when you make the production version of your game, change the last parameter of setOrbitMode() to true, for the player cant control the camera.
* TGE 1.52 Note: the function setOrbitMode() dont have the last 2 parameters, so you need to put the offset in the datablock ("0.0 -30.0 80.0" x,y,z respectively) or update your camera function.
www.garagegames.com/community/resources/view/8413
www.garagegames.com/community/forums/viewthread/42234/1#comment-325304
INSTRUCTIONS ADVANCED CAMERA RESOURCE
__________________________________________
(Tested in TGE 1.52, but if you can setup the AdvCamera in TGEA or T3D may works.)
1. Setup the advanced camera resource (thanks to ManOfIce): (www.garagegames.com/community/resources/view/5471)
2. Create the AdvCamera in OnclientEnterGame, but not delete the standard camera for the mission editor...
3. Delete the AdvCamera
4. Set the camera, to the end of function GameConnection::createPlayer( and replace the old camera code with this.
5. The camera settings, in camera.cs or when you want to put the code...
BONUS
_________
for make zoom with your mouse, put this code in default.bind.cs (client scripts)

INSTRUCTIONS STANDARD CAMERA
_______________________________
I'm not a Torque networking expert, but i think that the standard camera its better for multiplayer games that the advanced camera.
1. Replace in function GameConnection::createPlayer(%this, %spawnPoint)
// Give the client control of the player %this.player = %player; %this.setControlObject(%player);
with
( TGEA AND T3D )
// Give the client control of the player
%this.player = %player;
setFov(8);
%camvect = " 0.0 00.0 0.4 0.8 -0.8";
%this.camera.setOrbitMode(%this.player, %camvect, 5.0, 30.0, 5.0, true, "0.0 -30.0 80.0", false);
%this.setControlObject(%this.player); //- Set the control object to the player
%this.setCameraObject(%this.camera); //- Set the camera object to the cameraTip: when you make the production version of your game, change the last parameter of setOrbitMode() to true, for the player cant control the camera.
* TGE 1.52 Note: the function setOrbitMode() dont have the last 2 parameters, so you need to put the offset in the datablock ("0.0 -30.0 80.0" x,y,z respectively) or update your camera function.
www.garagegames.com/community/resources/view/8413
www.garagegames.com/community/forums/viewthread/42234/1#comment-325304
// Give the client control of the player
%this.player = %player;
setFov(8);
%camvect = " 0.0 00.0 0.4 0.8 -0.8";
%this.camera.setOrbitMode(%this.player, %camvect, 5.0, 30.0, 5.0, true);
%this.setControlObject(%this.player); //- Set the control object to the player
%this.setCameraObject(%this.camera); //- Set the camera object to the camera INSTRUCTIONS ADVANCED CAMERA RESOURCE
__________________________________________
(Tested in TGE 1.52, but if you can setup the AdvCamera in TGEA or T3D may works.)
1. Setup the advanced camera resource (thanks to ManOfIce): (www.garagegames.com/community/resources/view/5471)
2. Create the AdvCamera in OnclientEnterGame, but not delete the standard camera for the mission editor...
function GameConnection::onClientEnterGame(%this) {
commandToClient(%this, 'SyncClock', $Sim::Time - $Game::StartTime);
// create advanced camera
%this.advCamera = new AdvancedCamera() {
dataBlock = AdvCameraData;
};
MissionCleanup.add(%this.advCamera);
%this.advCamera.scopeToClient(%this);
// standar camera only for debug, we need for flymode in editors
if (getBuildString() $= "Debug") {
%this.camera = new Camera() {
dataBlock = Observer;
};
MissionCleanup.add( %this.camera );
%this.camera.scopeToClient(%this);
}
%this.setFirstPerson(false);
// Create a player object.
%this.spawnPlayer();
}3. Delete the AdvCamera
function GameConnection::onClientLeaveGame(%this) {
if (isObject(%this.advCamera))
%this.advCamera.delete();
...4. Set the camera, to the end of function GameConnection::createPlayer( and replace the old camera code with this.
%this.camera.setTransform(%spawnPoint);
%this.advCamera.setTransform(%spawnPoint);
%this.advCamera.setPlayerObject(%player);
%this.advCamera.setTargetObject(%player);
%this.advCamera.setGodViewMode();
%this.setCameraObject(%this.advCamera);
%this.advCamera.setFollowTerrainMode(true);
setFov(8);
%this.setControlObject(%player);5. The camera settings, in camera.cs or when you want to put the code...
$advCamera::Yaw = 0; $advCamera::Pitch = 20; $advCamera::Zoom = 0; //$advCamera::azimuth = ; //$advCamera::declination = ; $advCamera::zoomDistance = 10;
datablock AdvancedCameraData(AdvCameraData)
{
lookAtOffset = "0 0 2";
thirdPersonOffset = "0 -3 3";
godViewOffset = "45 -60 60"; //"0 -20 20";
maxTerrainDiff = 2;
orbitMinMaxZoom = "5 100";
orbitMinMaxDeclination = "10 80";
damping = 0.25;
};BONUS
_________
for make zoom with your mouse, put this code in default.bind.cs (client scripts)
function handleMouseWheel(%val) {
if ( %val < 0 )
setFOV ( $cameraFOV + 5);
else
setFOV ( $cameraFOV - 5);
}
moveMap.bind( mouse, zaxis, handleMouseWheel ); // zoomAbout the author
God blessed me with a brilliant mind... so im a genius...
#2
10/03/2009 (9:56 am)
Looks good, screenshot says it all. :)
#3
10/03/2009 (10:37 am)
Cool Resource! Thanks!
#4
10/05/2009 (11:01 am)
Nice to have it all in one place in an easy-to-read manner! I need to do this with the object selection resources. Awesome job Javier!
#5
10/06/2009 (6:39 pm)
Thanks!
#6
I altered function GameCore::preparePlayer(%game, %client); changed the line by adding a third argument to the function call:
%game.spawnPlayer(%client, %playerSpawnPoint); to
%game.spawnPlayer(%client, %playerSpawnPoint, false);
and then in the spawnsphere script I added:
LocalClientConnection.camera.setOrbitObject($SpawnObject, mDegToRad(50) @ " 0 0", 0, 30, 30);
but this way obviously removes my ability to control the player, hence my predicament; I carnt seem to get your way to work, and my way sucks. Any idea how I could get your method to work in T3D, maybe im being an idiot and just carn't find the gameconnection::createplayer function. Basically, im just trying to get the isometic camera, whilst keeping control of the player with w,a,s,d.
01/23/2010 (4:13 pm)
This may seem like a really stupid question, but im using T3D, and I cant find the function GameConnection::createPlayer(%this, %spawnPoint). I think it has been altered to function GameConnection::spawnPlayer(%this, %spawnPoint, %noControl). But I carnt figure out how to incorporate your way of establishing orbit mode into this new function. I have managed to get an isometric camera by setting orbit mode using script in the spawn sphere and removing client control: I altered function GameCore::preparePlayer(%game, %client); changed the line by adding a third argument to the function call:
%game.spawnPlayer(%client, %playerSpawnPoint); to
%game.spawnPlayer(%client, %playerSpawnPoint, false);
and then in the spawnsphere script I added:
LocalClientConnection.camera.setOrbitObject($SpawnObject, mDegToRad(50) @ " 0 0", 0, 30, 30);
but this way obviously removes my ability to control the player, hence my predicament; I carnt seem to get your way to work, and my way sucks. Any idea how I could get your method to work in T3D, maybe im being an idiot and just carn't find the gameconnection::createplayer function. Basically, im just trying to get the isometic camera, whilst keeping control of the player with w,a,s,d.
Torque Owner Krystian Lahage