3rd person veiw.
by Harrison Brock · in Torque Game Engine · 04/14/2007 (7:43 am) · 3 replies
I have a jet load into TGE. Am call this function:
unction VehicleData::onAdd(%data, %obj)
{
toggleFirstPerson(1);
....
.....
}
How do you setup a 3rd person veiw with the FlyingVehicleData datablock? What I have work but if I exit the level and click on start missiion button the game start back with the First person view.
Thanks for any help
unction VehicleData::onAdd(%data, %obj)
{
toggleFirstPerson(1);
....
.....
}
How do you setup a 3rd person veiw with the FlyingVehicleData datablock? What I have work but if I exit the level and click on start missiion button the game start back with the First person view.
Thanks for any help
#2
04/15/2007 (1:35 pm)
Thanks that works. So easy I over looked it.
#3
Like:
function GameConnection::onConnect( %client, %name )
{
// Send down the connection error info, the client is
// responsible for displaying this message if a connection
// error occures.
messageClient(%client,'MsgConnectionError',"",$Pref::Server::ConnectionError);
// Send mission information to the client
sendLoadInfoToClient( %client );
// Simulated client lag for testing...
// %client.setSimulatedNetParams(0.1, 30);
// Get the client's unique id:
// %authInfo = %client.getAuthInfo();
// %client.guid = getField( %authInfo, 3 );
%client.guid = 0;
addToServerGuidList( %client.guid );
// Set admin status
if (%client.getAddress() $= "local") {
%client.isAdmin = true;
%client.isSuperAdmin = true;
}
else {
%client.isAdmin = false;
%client.isSuperAdmin = false;
}
// Save client preferences on the connection object for later use.
%client.gender = "Male";
%client.armor = "Light";
%client.race = "Human";
%client.skin = addTaggedString( "base" );
%client.setPlayerName(%name);
%client.score = 0;
//
echo("CADD: " @ %client @ " " @ %client.getAddress());
// Inform the client of all the other clients
%count = ClientGroup.getCount();
for (%cl = 0; %cl < %count; %cl++) {
%other = ClientGroup.getObject(%cl);
if ((%other != %client)) {
// These should be "silent" versions of these messages...
messageClient(%client, 'MsgClientJoin', "",
%other.playerName,
%other,
%other.sendGuid,
%other.score,
%other.isAIControlled(),
%other.isAdmin,
%other.isSuperAdmin);
}
}
// Inform the client we've joined up
messageClient(%client,
'MsgClientJoin', 'Welcome to a Torque application %1.',
%client.playerName,
%client,
%client.sendGuid,
%client.score,
%client.isAiControlled(),
%client.isAdmin,
%client.isSuperAdmin);
// Inform all the other clients of the new guy
messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.',
%client.playerName,
%client,
%client.sendGuid,
%client.score,
%client.isAiControlled(),
%client.isAdmin,
%client.isSuperAdmin);
// If the mission is running, go ahead download it to the client
if ($missionRunning)
{
%client.loadMission();
}
else if ($Server::LoadFailMsg !$= "")
{
messageClient(%client, 'MsgLoadFailed', $Server::LoadFailMsg);
}
$Server::PlayerCount++;
ServerConnection.setFirstPerson(false);
}
09/21/2011 (9:49 pm)
Didnt work for me. I put it at the end of the function GameConnection::onConnect( %client, %name ) Like:
function GameConnection::onConnect( %client, %name )
{
// Send down the connection error info, the client is
// responsible for displaying this message if a connection
// error occures.
messageClient(%client,'MsgConnectionError',"",$Pref::Server::ConnectionError);
// Send mission information to the client
sendLoadInfoToClient( %client );
// Simulated client lag for testing...
// %client.setSimulatedNetParams(0.1, 30);
// Get the client's unique id:
// %authInfo = %client.getAuthInfo();
// %client.guid = getField( %authInfo, 3 );
%client.guid = 0;
addToServerGuidList( %client.guid );
// Set admin status
if (%client.getAddress() $= "local") {
%client.isAdmin = true;
%client.isSuperAdmin = true;
}
else {
%client.isAdmin = false;
%client.isSuperAdmin = false;
}
// Save client preferences on the connection object for later use.
%client.gender = "Male";
%client.armor = "Light";
%client.race = "Human";
%client.skin = addTaggedString( "base" );
%client.setPlayerName(%name);
%client.score = 0;
//
echo("CADD: " @ %client @ " " @ %client.getAddress());
// Inform the client of all the other clients
%count = ClientGroup.getCount();
for (%cl = 0; %cl < %count; %cl++) {
%other = ClientGroup.getObject(%cl);
if ((%other != %client)) {
// These should be "silent" versions of these messages...
messageClient(%client, 'MsgClientJoin', "",
%other.playerName,
%other,
%other.sendGuid,
%other.score,
%other.isAIControlled(),
%other.isAdmin,
%other.isSuperAdmin);
}
}
// Inform the client we've joined up
messageClient(%client,
'MsgClientJoin', 'Welcome to a Torque application %1.',
%client.playerName,
%client,
%client.sendGuid,
%client.score,
%client.isAiControlled(),
%client.isAdmin,
%client.isSuperAdmin);
// Inform all the other clients of the new guy
messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.',
%client.playerName,
%client,
%client.sendGuid,
%client.score,
%client.isAiControlled(),
%client.isAdmin,
%client.isSuperAdmin);
// If the mission is running, go ahead download it to the client
if ($missionRunning)
{
%client.loadMission();
}
else if ($Server::LoadFailMsg !$= "")
{
messageClient(%client, 'MsgLoadFailed', $Server::LoadFailMsg);
}
$Server::PlayerCount++;
ServerConnection.setFirstPerson(false);
}
Torque Owner Andy Rollins
ZDay Game
in common/server/clientConnection.cs:
function GameConnection::onConnect( %client, %name ) { ... ServerConnection.setFirstPerson(false); // added at the end }or in starter.fps/server/scripts/game.cs:
function GameConnection::createPlayer(%this, %spawnPoint) { ... %this.setFirstPerson(false); }Both work but perhaps someone more experienced can comment if there is a right place to put it and hopefully an explanation as to why.
As a side note you should make sure a couple of parameters in the vehicle data block are set correctly otherwise you won't get into 3rd person view, the correct setting should be:
datablock FlyingVehicleData( myFlyingVehicle ) { ... firstPersonOnly = false; observeThroughObject = true; };firstPersonOnly - Render shape when in first person (only applies to shapes that
are observed through.
observeThroughObject - If true, camera will use this shape's camera parameters, when
this is the controlled object
If you want to disable 1st person view completely then just remove the actionmap or delete the code from toggleFirstperson function.
Hope that helps.