Re: Question... [message #466413 is a reply to message #465856] |
Fri, 20 April 2012 07:14 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
|
Get_Facing/Set_Facing are definatly manipulating the Z axis. Get_Facing is calling Matrix3D::Get_Z_Rotation.
The reason Rotation.Z and Get_Facing/Set_Facing are different is that Get_Facing converts the returned result from Radians to Degrees before it returns it and Set_Facing converts the passed in value to Radians before using it.
The Matrix3D functions do not do this.
If you need to do the conversion, use DEG_TO_RADF and RAD_TO_DEGF.
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
Re: Question... [message #466421 is a reply to message #466413] |
Fri, 20 April 2012 11:07 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
jonwil wrote on Fri, 20 April 2012 16:14 | Get_Facing/Set_Facing are definatly manipulating the Z axis. Get_Facing is calling Matrix3D::Get_Z_Rotation.
The reason Rotation.Z and Get_Facing/Set_Facing are different is that Get_Facing converts the returned result from Radians to Degrees before it returns it and Set_Facing converts the passed in value to Radians before using it.
The Matrix3D functions do not do this.
If you need to do the conversion, use DEG_TO_RADF and RAD_TO_DEGF.
|
huh :s
what the code does for me right now is
create a zone thats not even slight in th right facing its just a random direction and its not really usefull
and if i understand correctly i can solve that by
doing DEG_TO_RADF(Commands->Get_Facing(obj))to set the Z rotation?
yep that did it thnx guys
can i attach a zone to a object?
Owner of kambot TT server
kambot.freeforums.org
[Updated on: Sat, 21 April 2012 06:24] Report message to a moderator
|
|
|
Re: Question... [message #466835 is a reply to message #466348] |
Sat, 28 April 2012 16:19 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
Whitedragon wrote on Thu, 19 April 2012 05:01 |
The code below will create a zone at the base center. For some maps, like Canyon and Glacier, you'll need more than one zone to properly cover the base.
Vector3 Get_Base_Center(int Team) {
Vector3 ReturnPos(0.0f,0.0f,0.0f);
BaseControllerClass *Base = BaseControllerClass::Find_Base(Team);
if (Base) {
int Num = 0;
for (Num = 0;Num < Base->BuildingList.Count();Num++) {
ReturnPos += Commands->Get_Position(Base->BuildingList[Num]);
}
if (Num) {
ReturnPos /= (float)Num;
}
}
return ReturnPos;
}
void LevelLoaded() {
Vector3 Size = Vector3(50.0f,50.0f,50.0f); //Should load the size per map from a config file.
Matrix3 Rotation(true);
Rotation.Rotate_Z(1.0f); //Should load a rotation per map from a config file.
OBBoxClass Box(Get_Base_Center(0),Size,Rotation); //Create the bounding box with the position of the Nod base, and the size and rotation defined earlier.
GameObject* Zone = Create_Zone("Script_Zone_All",Box);
//Attach whatever script you want to the zone now.
}
|
i wanted to use this but i cant, buildinglist is inaccesible, so i cant do it this
Owner of kambot TT server
kambot.freeforums.org
|
|
|