How do I position a player with setTransform in TorqueScript?
by Conrad Nel · in Torque Game Engine · 05/05/2007 (5:11 am) · 2 replies
Hi there
I'm a total newbie with developing in torquescript.
I'm building a 3D project for a Real estate company.
They want to construct a place called Palm Lakes Estate.
I'm struggling with the process of placing the player on specific places
in my 3d world.
When I click a button on the playGUI, the player needs to go to the balcony of a house.
What I have so far is:
On the button click, I call MoveToBalcony();
I have added these lines in the server\player.cs file...
function MoveToBalcony()
{
commandToServer('SetPlayerOnBalcony');
}
I have added these lines in the server\game.cs file...
function serverCmdSetPlayerOnBalcony(%client)
{
if(isObject(%client.player))
{
%pos = getTransform(balconyb1); // balconyb1 is the object placeholder, where my player
// should go to
%client.player.setTransform(%pos);
}
}
The problem is, when I click on the button, I get the error :
"serverCmdSetPlayerOnBalcony - unknown command"
Anyone know what i'm doing wrong?
I'm a total newbie with developing in torquescript.
I'm building a 3D project for a Real estate company.
They want to construct a place called Palm Lakes Estate.
I'm struggling with the process of placing the player on specific places
in my 3d world.
When I click a button on the playGUI, the player needs to go to the balcony of a house.
What I have so far is:
On the button click, I call MoveToBalcony();
I have added these lines in the server\player.cs file...
function MoveToBalcony()
{
commandToServer('SetPlayerOnBalcony');
}
I have added these lines in the server\game.cs file...
function serverCmdSetPlayerOnBalcony(%client)
{
if(isObject(%client.player))
{
%pos = getTransform(balconyb1); // balconyb1 is the object placeholder, where my player
// should go to
%client.player.setTransform(%pos);
}
}
The problem is, when I click on the button, I get the error :
"serverCmdSetPlayerOnBalcony - unknown command"
Anyone know what i'm doing wrong?
About the author
#2
The problem was that I was using %player (local variable),
instead of $player (global variable).
I created $player in the createplayer function:
$player = %player
05/07/2007 (12:10 pm)
It's working now!The problem was that I was using %player (local variable),
instead of $player (global variable).
I created $player in the createplayer function:
$player = %player
Torque 3D Owner mb