Game Development Community

Player.setTransform("320 316.209 217.5 minipulation

by Bill · in Torque Game Engine · 10/10/2006 (4:11 pm) · 0 replies

I am trying to use setTranform to get the ORC in the world to lay down turn on its side but I can not spawn him in the world nor can I use the gui interface to get him to lay sideways any help appreciated, thanks!!!!!

Am I using the wrong function?

does the version I am using support radians or degrees?

SetTransform is used to set the position and rotation of an object:

SetTransform("px py pz rx ry rz rd")
Px py pz; XYZ coordinates of the rotation

Rx ry rz rd define a quaternion: the rx ry rz define the axis of rotration and the rd defines the angle in degrees.

In the rotation example in chapter 3, it seems that the TGE uses radians? However, messing around with the world editor in the TGE 1.4 demos shows that it is using degrees! Perhaps the author has modified the engine?

HERE IS THE SNIPET OF CODE:

//===================== SETUP THE TOWN PATROLLING BOT AND 2 SCOUTS ==========================
//SET THE PATH TO BE townPath BECAUSE WE WANT THE BOT TO FOLLOW THE TOWN PATHS
//THE NAME townPath WAS SET IN THE FILE stronghold.mis AT THE BOTTOM.
//THE BOT WILL BEGIN AT THE NODE $TorkStartNode. $TorkStartNode IS INITIALIZED WITH THE GLOBALS
%path = "MissionGroup/Paths/townPath";
%player = AIPlayer::spawnOnPath("Tork","patrol",%path,$TorkStartNode);


//MAKE THE BOT BEGIN FOLLOWING ITS RESPECTIVE PATH
%player.followPath(%path,-1);

echo("is thisRRRRRRRRRRRRRRRRIIIIIIIIIGGGGGGGGGGGGGGGHHHHHHHHHHHHTTTTTT");

//SET THE CROSSBOW IMAGE IN THE BOTS HANDS AND INITIALIZE HIS CrossbowAmmo TO 1000 BOLTS.
%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);

//LOAD THE PATROLLER'S TABLE OF NODE DATA DIRECTLY INTO THE BOT. THIS TABLE IS INITIALIZED WITH THE GLOBALS.
//HERE WE ARE LOADING tpath BECAUSE WE WANT HIM TO FOLLOW THE TOWN TABLE
//EXAMPLE: HERE IS THE DATA FOR TOWN NODE 0 ($tpath[0]) AND TOWN NODE 1 ($tpath[1])
// $tpath[0] = "regular 66 18 83 5 99 1";
// $tpath[1] = "door 66 4 99 15";
//bottable[0] will equal $tpath[0], bottable[1] will equal $tpath[1], etc.
//bottable WILL BE USED IN moveToNextNode. IT CAN BE ACCESSED THERE AND WITHIN OTHER FUNCTIONS
//BY USING THE FOLLOWING: %this.bottable[%x] WHERE %x IS THE NODE YOU WANT TO ACCESS
for(%i=0; %i<$TownNumberNodes; %i++)
{
%player.bottable[%i] = $tpath[%i];
}
//SETUP THE TWO SCOUTS AT THEIR RESPECTIVE STARTING NODES. $TorkScout1Node AND $TorkScout2Node ARE INITIALIZED WITH THE GLOBALS
%player = AIPlayer::spawnOnPath("TorkScout1","sleep",%path,$torkScout1Node);//.setTransform("-90 -2 20 0 0 1 0");







// %player.setTransform("320 316.209 217.515 0 -30 1 -60"); <<<<<<<-------------------- HERE!!!!!!!!!





// return %player;


%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);

%player = AIPlayer::spawnOnPath("TorkScout2","sleep",%path,$TorkScout2Node);

%player.mountImage(CrossbowImage,0);
%player.setInventory(CrossbowAmmo,1000);
-----------------------------------------------------------------------------------------------------------------------------------

please any suggestions on how to spawn the bot lying down pretending to sleep will be much appreciated!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

About the author

Recent Threads

  • Death Animation Sequance