Game Development Community

Setting third person to default view

by Karl Traunmueller · in Torque Game Engine · 10/08/2002 (7:32 am) · 4 replies

I'm just mucking around with the racing mod and trying to set the default view to third person.

Where and how do I do this?

The tab key calls toggleFirstPerson(), which toggles a (global?) variable $firstPerson. But whom does this $firstPerson belong to?

ShapeBase, from which WheeledVehicle is derived, calls con->isFirstPerson() in its isFirstPerson() member (the con pointer beeing a GameConnection*). GameConnection, in turn, has a mFirstPerson member, but I don't see the link between GameConnection::mFirstPerson (in C++) and $firstPerson (in the script).

Anyone?

(A side note: I don't find it good programming practice to put several classes into one .h/.cc file. This makes code navigation quite hard, at least for me.)

#1
10/08/2002 (10:46 am)
have you read any of the past threads? i recall someone mentioning this particular matter. anyway, i think (if im not wrong) that the solution was as simple as setting the $firstPerson to false:

$firstPerson = false;

correct me if im wrong, coz this is only what i think, i think it is.. hehehe

A I
#2
10/08/2002 (1:11 pm)
Of course I searched the forums before I posted the question. However, I couldn't find what I was looking for.

And believe me, I tried a lot of these "$firstPerson = false"-things, in many files.

I have serious trouble in understanding two things:
1) What has to be done/set up when and where. The scripting concept behind Torque makes it very flexible, but very hard to get a feel for the control flow. If everything were coded in C++, you could basically debug around until you have a good idea of what is happening when.
2) How do scripts and C++ interact. Like, how does a C++ class become scriptable? I guess, that's what DECLARE_CONOBJECT is part of, but I still can't figure out the above mentioned third person problem.
#3
10/08/2002 (1:21 pm)
Hm, a

$firstPerson = false;

at the end of fps/client/init.cs does the job, but I still don't know whether this $firstPerson refers to

gameConnection.cc(1510):
Con::addVariable("firstPerson", TypeBool, &mFirstPerson);

or

shapeImage.cc(395):
addField("firstPerson", TypeBool, Offset(firstPerson, ShapeBaseImageData));

I guess the former, hu?

addVariable() could be for global vars, and addField for class variables.
#4
10/08/2002 (4:08 pm)
The code from gameconnection is adding the variable to the console (Con::addVariable())