Game Development Community

Where can I call camera.setTransform()?

by Alex Rice · in Torque Game Engine · 11/22/2004 (8:27 pm) · 4 replies

I have set $firstPerson to false, and I want to adjust the camera placement so it's above and farther back looking down on my player.

I started with the starter.fps. Like starter.fps, I called camera.setTransform() in GameConnection::createPlayer(). That had no effect. So I launched the original starter.fps and commented out this line:

%this.camera.setTransform(%player.getEyeTransform());

still there is no difference in the placement of the camera. It's as if the engine is overriding the camera transformation and ignoring the setTransformCall()?

Here is what I'm trying to do:

%xfrm = %player.getEyeTransform();
%lx = getWord(%xfrm, 0);
%ly = getWord(%xfrm, 1);
%lz = getWord(%xfrm, 2);
%rx = getWord(%xfrm, 3);
%ry = getWord(%xfrm, 4);
%rz = getWord(%xfrm, 5);
%ra = getWord(%xfrm, 6);
 // do transform
%lz += 10; // or something
 %this.camera.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %ra);

#1
11/22/2004 (10:24 pm)
The position of the camera relative to your player is determined by a node in the .dts file. I believe it's the "cam" node for third person and "eye" for first person. www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4273
#2
11/22/2004 (10:57 pm)
Plus this might be of interest:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5471. Fantastic ressource btw. from the 'man of ice'.
#3
11/24/2004 (7:28 pm)
Thanks guys, for the help
#4
11/24/2004 (7:36 pm)
@Alex: As everyone has said/implied so far, camera position isn't nearly as static as it may seem--it's almost always tied to a control object (but not always, see the RTS Starter Kit for example), and is processed every "tick" (1/32 of a second I believe, don't quote me on that) for updates/movement.

As Dirk gave the link for, the Adv Camera most likely has a camera mode for what you are looking for, or you can easily adjust the parameters for an existing mode to get your camera position down pat.