Game Development Community

Orbiting Camera

by Quentin Headen · in Torque Game Engine · 09/27/2007 (8:24 am) · 4 replies

Hello! How can I orbit the camera around a car? For example, when the race starts, I want to get a 360 view of the car. If you know how, please let me know.

Thanks :)

About the author

Just your average programmer who tries to finish the projects he starts. :) I am currently focused on creating games with Torque engines. My website is http://phaseshiftsoftware.com


#1
10/01/2007 (4:54 am)
Yea i want to now that to.
#2
10/03/2007 (10:41 am)
Can someboty anwser please???
#3
10/03/2007 (10:55 am)
Create a path at the start of the race and set the camera to that path. For an example, look at the code for the walk through demo. It has pathed cameras moving all over the place. If you want an arbitrary camera round-about, then you'll need to implement the Advanced Camera resource--for example, if you want it to orbit when the player is set back on the track or something.
#4
10/03/2007 (12:32 pm)
I was browsing around my "Game Programmer's Guide to Torque" book and I found out how to do it. You don't have to mod the source code. Here is the code to do it:

//First get the camera name, and set it as the control object
LocalClientConnection.setControlObject(camera_name_goes_here);

//Then store the camra object in a global variable so you can access it easly
$camera = LocalClientConnection.getControlObject();

//Then you set the camera mode to orbit by doing this
$camera.setOrbitMode(%orbitObject, %orbitObjectTransform, 10.0, 15.0, 10.0);

//I think the 10.0, 15.0, and 10.0 at the end are the XYZ distances of the camera from the object
//Now when you move the mouse around, it will orbit the object :)