NetObject
Superclass for all ghostable networked objects.
Public Functions
void
Clears the scope always flag on this object.
void
clearScopeToClient(NetConnection client)
Undo the effects of a scopeToClient() call.
int
Returns a pointer to the client object when on a local connection.
int
Get the ghost index of this object from the server.
int
Returns a pointer to the client object when on a local connection.
bool
Called to check if an object resides on the clientside.
bool
Checks if an object resides on the server.
void
scopeToClient(NetConnection client)
Cause the NetObject to be forced as scoped on the specified NetConnection.
void
Always scope this object on all connections.
Detailed Description
Superclass for all ghostable networked objects.
Public Functions
clearScopeAlways()
Clears the scope always flag on this object.
clearScopeToClient(NetConnection client)
Undo the effects of a scopeToClient() call.
Parameters:
client | The connection to remove this object's scoping from |
getClientObject()
Returns a pointer to the client object when on a local connection.
Short-Circuit-Networking: this is only valid for a local-client / singleplayer situation.
the SimObject ID of the client object.
// Psuedo-code, some values left out for this example %node = new ParticleEmitterNode(){}; %clientObject = %node.getClientObject(); if(isObject(%clientObject) %clientObject.setTransform("0 0 0");
local_connections
getGhostID()
Get the ghost index of this object from the server.
The ghost ID of this NetObject on the server
%ghostID = LocalClientConnection.getGhostId( %serverObject );
getServerObject()
Returns a pointer to the client object when on a local connection.
Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation.
The SimObject ID of the server object.
// Psuedo-code, some values left out for this example %node = new ParticleEmitterNode(){}; %serverObject = %node.getServerObject(); if(isObject(%serverObject) %serverObject.setTransform("0 0 0");
local_connections
isClientObject()
Called to check if an object resides on the clientside.
True if the object resides on the client, false otherwise.
isServerObject()
Checks if an object resides on the server.
True if the object resides on the server, false otherwise.
scopeToClient(NetConnection client)
Cause the NetObject to be forced as scoped on the specified NetConnection.
Parameters:
client | The connection this object will always be scoped to |
// Called to create new cameras in TorqueScript // %this - The active GameConnection // %spawnPoint - The spawn point location where we creat the camera function GameConnection::spawnCamera(%this, %spawnPoint) { // If this connection's camera exists if(isObject(%this.camera)) { // Add it to the mission group to be cleaned up later MissionCleanup.add( %this.camera ); // Force it to scope to the client side %this.camera.scopeToClient(%this); } }
setScopeAlways()
Always scope this object on all connections.
The object is marked as ScopeAlways and is immediately ghosted to all active connections. This function has no effect if the object is not marked as Ghostable.