MoveManager improvement for mounting turrets to vehicles
by Dan Keller · 10/31/2005 (2:01 pm) · 12 comments
Download Code File
This is an improvement on the turret class (click here to see it). What it does is extend the Move structure and the MoveManager class to include two new variables, tpitch and tyaw. They can be accessed in the script as $mvTurretPitch and $mvTurretYaw.
How to install:
1. The files in the zip file are complete, so if you haven't made any changes to the corresponding files in the game, you can just unzip them over the original files. If you have changed one or both of these files, the added parts are denoted with comments.
2. In game\turrets\turret.cc and game\turrets\aiTurret.cc, replace move->pitch and move->yaw with move->tpitch and move->tyaw, every time they occur.
3. Make the changes shown in Raverix's post here
4. Now add $mvTurretYaw = getMouseAdjustAmount(%val); in the script where you change the yaw and $mvTurretPitch = getMouseAdjustAmount(%val); where you change the pitch.
This is an improvement on the turret class (click here to see it). What it does is extend the Move structure and the MoveManager class to include two new variables, tpitch and tyaw. They can be accessed in the script as $mvTurretPitch and $mvTurretYaw.
How to install:
1. The files in the zip file are complete, so if you haven't made any changes to the corresponding files in the game, you can just unzip them over the original files. If you have changed one or both of these files, the added parts are denoted with comments.
2. In game\turrets\turret.cc and game\turrets\aiTurret.cc, replace move->pitch and move->yaw with move->tpitch and move->tyaw, every time they occur.
3. Make the changes shown in Raverix's post here
4. Now add $mvTurretYaw = getMouseAdjustAmount(%val); in the script where you change the yaw and $mvTurretPitch = getMouseAdjustAmount(%val); where you change the pitch.
About the author
#2
Is there anyway to mail him?
11/03/2005 (9:23 am)
Hello Dan? Michael is correct, you need to re-upload the zip.Is there anyway to mail him?
#3
11/12/2005 (11:23 am)
Sorry about that.
#4
Works a charm.. Now to just get the turret pointing towards the direction my Advanced camera in orbit mode..
11/24/2005 (11:42 am)
Sweet Sweet with a double helping of Sweet... with a strawberry on the top.Works a charm.. Now to just get the turret pointing towards the direction my Advanced camera in orbit mode..
#5
To fix this in aiTurret.cc change all
movePtr->yaw to movePtr->tyaw
and
movePtr->pitch to movePtr->tpitch
01/03/2006 (6:35 pm)
Seems this breaks the AITurrets though.To fix this in aiTurret.cc change all
movePtr->yaw to movePtr->tyaw
and
movePtr->pitch to movePtr->tpitch
#6
I literally just replaced the exact string you say in step 2 and replaced every instance in turret.cc and it works great. thankyou.
//turret move binds
//---------------------------------------
function Yaw_Right(%make)
{
$mvTurretYaw += %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
function Yaw_Left(%make)
{
$mvTurretYaw -= %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
function Pitch_Up(%make)
{
$mvTurretPitch += %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
function Pitch_Down(%make)
{
$mvTurretPitch -= %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
movemap.bind( keyboard,right, Yaw_Right );
movemap.bind( keyboard,left, Yaw_Left );
movemap.bind( keyboard,up, Pitch_up );
movemap.bind( keyboard,down, Pitch_Down );
04/06/2007 (8:02 pm)
Hi I have problems understanding step 2, Could you please give me the line numbers for the move->tpitch changes? Thanks for the resource!I literally just replaced the exact string you say in step 2 and replaced every instance in turret.cc and it works great. thankyou.
//turret move binds
//---------------------------------------
function Yaw_Right(%make)
{
$mvTurretYaw += %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
function Yaw_Left(%make)
{
$mvTurretYaw -= %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
function Pitch_Up(%make)
{
$mvTurretPitch += %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
function Pitch_Down(%make)
{
$mvTurretPitch -= %make ? $Pref::Input::KeyboardTurnSpeed : 0;
}
movemap.bind( keyboard,right, Yaw_Right );
movemap.bind( keyboard,left, Yaw_Left );
movemap.bind( keyboard,up, Pitch_up );
movemap.bind( keyboard,down, Pitch_Down );
#7
I uploaded a patch to apply on a clean 1.4.2 TGE install on my website here, and I left this resource's code commented out.
Can you give me some hints on what I done wrong? Thanks in advance for anything.
Bye, Berserk.
.
09/11/2007 (5:46 pm)
Hello. I had some troubles using this resource in my project (see here for details).I uploaded a patch to apply on a clean 1.4.2 TGE install on my website here, and I left this resource's code commented out.
Can you give me some hints on what I done wrong? Thanks in advance for anything.
Bye, Berserk.
.
#8
09/14/2007 (9:01 pm)
What sort of problems are you having? Are there compile errors, or does something not work in game?
#9
However, the engine crashes at mission loading stage 1.
Thanks for your help and excuse my latency.
Bye, Berserk.
.
09/18/2007 (10:11 am)
Compiles fine, except some source code errors I hd to comment out (those who were calling IMPLEMENT_CONOBJECT(...) function outside any function code).However, the engine crashes at mission loading stage 1.
Thanks for your help and excuse my latency.
Bye, Berserk.
.
#10
09/27/2007 (5:31 pm)
You might be missing a bracket somewhere ... That's all I can think of.
#11
01/28/2008 (12:15 am)
Anyone have any clue why one would lose the ability to aim a turret? if implement instructions as dictated, I lose the capability. I have narrowed it down to the move->tpitch and move->tyaw pointers. If I change them back to pitch and yaw, I can not only control the turret fine, but i can also control it in my vehicle(of course, then controlling the vehicle too.)
#12
04/20/2008 (5:17 pm)
Dan, your resources are the shit. I love 'em. 
Torque 3D Owner Michael Cozzolino
Big Monk Games