SetControlObject
by Brandon Fogerty · in Torque Game Engine · 07/04/2007 (6:42 pm) · 2 replies
I was reading the gpgt book and on page 205 it is talking about setting the control object.
From ym understanding, when you set the control object, you are setting what the player will control.
IE a camera, a player model, etc.
My question then is how do I get the instance of the camera in the
GameConnection::createPlayer(%this, %spawnPoint)
callback?
For example, I would like to set the control object to the camera by default as opposed to the Player model.
However the %client object is not passed in this function. How can I get an instance of the client or the camera so that I can set it as the control object in this function? Thanks in advance!
From ym understanding, when you set the control object, you are setting what the player will control.
IE a camera, a player model, etc.
My question then is how do I get the instance of the camera in the
GameConnection::createPlayer(%this, %spawnPoint)
callback?
For example, I would like to set the control object to the camera by default as opposed to the Player model.
However the %client object is not passed in this function. How can I get an instance of the client or the camera so that I can set it as the control object in this function? Thanks in advance!
#2
You would simply set the camera object (which is also created in ::onClientEnterGame) as the control object instead.
07/05/2007 (8:08 am)
You are one level too deep however--GameConnection::onClientEnterGame() is what (ultimately) calls ::createPlayer, as well as where the player avatar is set as the control object (it's one line of script near the bottom, can't miss it).You would simply set the camera object (which is also created in ::onClientEnterGame) as the control object instead.
Torque 3D Owner Maxime Jouin
Default Studio Name
Hope this helps.