T3D 1.1 Beta 3 - ClearControlObject() clears nothing - LOGGED - Resolved
by Steve Acaster · in Torque 3D Professional · 02/16/2011 (4:45 pm) · 3 replies
T3D 1.1 Beta 3
win7 32bit
Target:
Player function, client connection, controlobject
Issue
Player funtion void clearControlObject() clears nothing. (unless I'm making a pig's ear of it)
Also shouldn't this be a clientConnection function rather than the player funtion as the player object is the controlObject?
Repeat
Spawn as a player in a level and in the console activate the clearControlObject() function.
Move around 'cos you still have player control and no controlObject has been cleared.
Now set the player to another controlObject (any object in-game) and see the player no longer respond.
Suggest
Make ClearControlObject do something (unless it does and I've made a hash of it)
win7 32bit
Target:
Player function, client connection, controlobject
Issue
Player funtion void clearControlObject() clears nothing. (unless I'm making a pig's ear of it)
Also shouldn't this be a clientConnection function rather than the player funtion as the player object is the controlObject?
Repeat
Spawn as a player in a level and in the console activate the clearControlObject() function.
%playerID.clearcontrolObject(); //also %playerID.clearcontrolObject(%playerID);
Move around 'cos you still have player control and no controlObject has been cleared.
Now set the player to another controlObject (any object in-game) and see the player no longer respond.
%playerID.setControlObject(%other_object_ID)
Suggest
Make ClearControlObject do something (unless it does and I've made a hash of it)
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#2
This is actually working correctly, though it seems that it's not doing what you expect it to...
I talked with another developer about the behavior of this function.
It turns out that the whole ControlObject system is a chain, which filters the appropriate inputs and passes them along to the next. If you notice at the bottom of GameConnection::SpawnPlayer() code, the GameConnection's control object is set to the player and passes it's input to it. If the player itself has no control object, then the "passing off" stops there, and the player receives the inputs.
Calling player.clearControlObject internally calls player.setControlObject(0), which does clear it. However since the GameConnection's control object is the player, he will still recieve input.
However if the player was in a vehicle (The vehicle being the player's control object now), clearing his control object there would return control to the player. (Try it, even though you'll still be mounted to the vehicle, moving your mouse will move the player's viewpoint, not the wheels of the car since it's no longer the player's control object.)
If you're looking to completely remove control from the player (For instance, to stop them from fidgeting during a cutscene) you should look into setting the control object on the GameConnection. You could set it to a fixed camera to "stop" all input. I'll make sure that this is a bit more clear in the docs : )
TL;DR: If you want the user to stop controlling the player, set the control object on the GameConnection, rather than calling clearControlObject() on the player itself.
04/29/2011 (3:30 pm)
Hey there Steve.This is actually working correctly, though it seems that it's not doing what you expect it to...
I talked with another developer about the behavior of this function.
It turns out that the whole ControlObject system is a chain, which filters the appropriate inputs and passes them along to the next. If you notice at the bottom of GameConnection::SpawnPlayer() code, the GameConnection's control object is set to the player and passes it's input to it. If the player itself has no control object, then the "passing off" stops there, and the player receives the inputs.
Calling player.clearControlObject internally calls player.setControlObject(0), which does clear it. However since the GameConnection's control object is the player, he will still recieve input.
However if the player was in a vehicle (The vehicle being the player's control object now), clearing his control object there would return control to the player. (Try it, even though you'll still be mounted to the vehicle, moving your mouse will move the player's viewpoint, not the wheels of the car since it's no longer the player's control object.)
If you're looking to completely remove control from the player (For instance, to stop them from fidgeting during a cutscene) you should look into setting the control object on the GameConnection. You could set it to a fixed camera to "stop" all input. I'll make sure that this is a bit more clear in the docs : )
TL;DR: If you want the user to stop controlling the player, set the control object on the GameConnection, rather than calling clearControlObject() on the player itself.
#3
04/30/2011 (5:00 am)
Problem solved then! :P
Associate David Wyand
Gnometech Inc.
Logged as THREED-1450. Thanks!
- Dave