Game Development Community

New Camera Help

by Luke Hopkins · in Torque Game Engine · 07/05/2006 (10:55 am) · 0 replies

Hey

I was woundering if anyone could help me make god camera work. I just wanted god camera so i want to get rid of third and first person. I tryed this resource
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5471
but it dosn't get rid of first person i was thinking of changing to Y,X and Z axis of third person and set first person to false would this work and how would i do it.

I found this code.

Adjustable distance in 3rd person mode
In game/advancedCamera.cc (line 221) add the following (addition in bold):

MatrixF objToWorld = playerObj->getRenderTransform();
mCurrentThirdPersonOffset = mDataBlock->thirdPersonOffset; // update 3rd person camera offset
objToWorld.mulP(mCurrentThirdPersonOffset, &cameraPosWorld);



To use this, in your scripts add the following:
client/scripts/default.bind.cs: (note: i am using $pref::Camera::CameraMode to track which camera selection is active)

function Zoom3rdPersonCamera(%val) {
if(%val) {
if($pref::Camera::CameraMode == 1) {
commandToServer('Camera_Zoom_3rd_Person', %val);
}
}
}
moveMap.bind(mouse, "zaxis", Zoom3rdPersonCamera);



now in server/scripts/commands.cs add:

function serverCmdCamera_Zoom_3rd_Person(%client, %val) {
%client.advCamera.setPlayerObject(%client);
%x_pos = firstWord(AdvCameraData.thirdPersonOffset);
%y_pos = getWord(AdvCameraData.thirdPersonOffset,1);
%z_pos = getWord(AdvCameraData.thirdPersonOffset,2);

if(%val > 0) {
%y_pos += 1;
} else {
%y_pos -= 1;
}

AdvCameraData.thirdPersonOffset = %x_pos @ " " @ %y_pos @ " " @ %z_pos;
}

Could i make this work to my advantage.

Thank You Luke