Jump to content
Sign in to follow this  
[aps]gnat

Working ArmA turret

Recommended Posts

I guess it could be like aircraft undercarriage and chopper defs, but has *anyone* managed to get a turret, any turret to rotate or elevate in ArmA?

Think Ive tried all the usual definitions like OtocVez and OsaVeze, including trying the apparent ArmA ones called MainTurret and MainGun, but they don't free up the turret.

The usti hlavne type points seem to work at least because at least the bullets exit the muzzle correctly, but thats about the limit for me so far.

My CONFIG is a near copy of those found within the game, so I'm thinking thats not the reason ..... I'm guessing the p3d definitions are the problem.

Appreciate feedback from anyone whos managed to get it working (or even has tried and failed also).

Cheers.

Share this post


Link to post
Share on other sites

I don't know what you can and can't do atm, but if you can't get a look at any ArmA models open in OFP Oxygen, you can at least see the named selections and memory names of the p3d in a hex editor.

Share this post


Link to post
Share on other sites

reading your post i was thinking "oh really i got it working?"..

small correction needed, the turret is working fine with mouse movements, however the bullet exit point isnt following.

incase anyone wonders..

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSkeletons

{

class Car; //Define base class.

class RC_SuperSonicBones: Car

{

isDiscrete=1;

skeletonInherit = ""; //Inherit all bones from class Car.

skeletonBones[]=

{

"pravy predni","",

"levy predni","",

"pravy zadnii","",

"levy zadni","",

"OtocVez","",

"OtocHlaven","OtocVez"

};

};

};

class CfgModels

{

class Car; //Declare base class.

class RC_SuperSonic: Car

{

sectionsInherit = "";

sections[] ={"OtocVez","OtocHlaven","pravy predni","pravy zadni","levy zadni","hatchGunner", "zadni svetlo","clan"};

skeletonName = "RC_SuperSonicBones";

class Animations

{

class RC_SuperSonicOtocVez

{

type = "rotationY";

source = "mainTurret";

selection = "OtocVez";

axis = "OsaVeze";

memory = true;

sourceAddress = "loop";

minValue = -1;

maxValue = 1;

angle0 = 0;

angle1 = "rad 360";

};

class RC_SuperSonichlaven

{

type = "rotationX";

source = "mainGun";

selection = "OtocHlaven";

axis = "OsaHlavne";

memory = true;

sourceAddress = "clamp";

minValue = "0";

maxValue = "1";

angle0 = "-rad 12";

angle1 = "rad 65";

};

};

class RC_SuperSonicFrontWheelR

{

type = "rotationX";

source = "wheel";

selection = "pravy predni";

axis = "";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

class RC_SuperSonicFrontWheelL

{

type = "rotationX";

source = "wheel";

selection = "levy predni";

axis = "";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

class RC_SuperSonicFrontWheelRTurn

{

type = "rotationY";

source = "drivingWheel";

selection = "pravy predni";

axis = "";

memory = true;

sourceAddress = "clamp";

minValue = -1;

maxValue = 1;

angle0 = "rad 25";

angle1 = "rad -25";

};

class RC_SuperSonicFrontWheelLTurn

{

type = "rotationY";

source = "drivingWheel";

selection = "levy predni";

axis = "";

memory = true;

sourceAddress = "clamp";

minValue = -1;

maxValue = 1;

angle0 = "rad 25";

angle1 = "rad -25";

};

class RC_SuperSonicRearWheelR

{

type = "rotationX";

source = "wheel";

selection = "pravy zadni";

axis = "";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

class RC_SuperSonicRearWheelL

{

type = "rotationX";

source = "wheel";

selection = "levy zadni";

axis = "";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

};

};

Share this post


Link to post
Share on other sites

Thanks GranQ smile_o.gif

Think I can see a bit more I can try using you definition ... cheers

Share this post


Link to post
Share on other sites

I got the bullet-thingy working on wheeled and tracked vehicles now, I just had a typo in the gunBeg and gunEnd parameters of the turret config. You should check that too.

Here's a working config for a turret using a machine gun:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Turret_MG3 : NewTurret

{

body="turret_mg3_x";

gun="turret_mg3_y";

gunBeg="usti hlavne";

gunEnd="konec hlavne";

weapons[]={"BWMod_MG3_Vehicle"};

magazines[]={"BWMod_MG3Mag","BWMod_MG3Mag"};

hasGunner=1;

soundServo[]={"\ca\wheeled\Data\Sound\servo3",0.000178,0.900000};

minElev=-25; maxElev=60;

gunnerAction="HMMWV_Gunner01";

outGunnerMayFire=1;

inGunnerMayFire=1;

startEngine=0;

class ViewGunner

{

initAngleX=5; minAngleX=-30; maxAngleX=30;

initAngleY=0; minAngleY=-100; maxAngleY=100;

initFov=0.700000; minFov=0.420000; maxFov=0.850000;

};

If you want to know how to define the turret in the cfgModels and cfgSkeletons class, please refer to my sandbox in the wiki.

The NewTurret baseclass is inherited from the core config.

Share this post


Link to post
Share on other sites

Thanks TeRpEnTiN, at least I've got the turret turning and the barrel elevating ....... but the cross hairs are locked forward.

I can't get the gun begin and end to rotate with the turrets, its stuck forward.

The "konec hlavne" and "usti hlavne" are under the "OtocHlaven" and "OtocVez" definitions but they won't budge.

In the non-optic view the white "cross hair" marker and gunner view is always forward yet you can move the barrel around within that view.

In the Optic view (in this case just down the barrel) the gunner view follows the barrel but the gun still only fires forward.

The konec hlavne and usti hlavne are in the Memory LOD, I even tried a copy in a Resolution LOD, no joy. Even added them to the sections[] def, no change.

Any further assistance appreciated. smile_o.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class GNT_PB

{

units[] = {MX_PBe, MX_PBw};

weapons[] = {};

};

};

class CfgSkeletons

{

  class Ship; //Define base class.

  class SmallShip: Ship{};

  class GNT_PBBones: SmallShip

  {

isDiscrete=1;

skeletonInherit = "";

skeletonBones[]=

{

"OtocVez","",         //defines bone turret_x

"OtocHlaven","OtocVez"  //defines bone turret_y and makes it linked to bone turret_x

};

   };

};

class cfgModels

{

class Ship;

class SmallShip: Ship{};

class schuna2a: SmallShip

{

skeletonName = "GNT_PBBones";

sectionsInherit="";

sections[]=

{

"OtocHlaven","OtocVez","konec hlavne","usti hlavne"

};

class Animations

{

class mainTurret //the horizontal moving part of the turret

{

type="rotationY";

source="mainTurret";

selection="OtocVez";

axis="osaveze";

animPeriod=0;

memory=1;

minValue="rad -360";

maxValue="rad +360";

angle0="rad -360";

angle1="rad +360";

};

class mainGun //the vertical moving part of the turret

{

type="rotationX";

source="mainGun";

selection="OtocHlaven";

axis="osahlavne";

animPeriod=0;

memory=1;

minValue="rad -360";

maxValue="rad +360";

angle0="rad -360";

angle1="rad +360";

};

};

};

class schuna2b: schuna2a {};

};

class CfgVehicles

{

class AllVehicles;

class Ship: AllVehicles{};

class SmallShip: Ship

{

class NewTurret;

class Turrets;

};

class MX_PBe: SmallShip

{

scope=public;

hasDriver=1;

hasGunner=1;

hasCommander=0;

driverisCommander=1;

// commanderCanSee=31;

gunnerCanSee="1+16 +4+8";

getInRadius=40;

insideSoundCoef = 0.01;

ejectDeadDriver=1;

ejectDeadGunner=1;

// ejectDeadCommander=1;

ejectDeadCargo=1;

picture="\OGNPBoat\miraj.paa";

irScanRange=4000;

irScanGround=1;

side=0;

type=VArmor;

crew="SoldierECrew";

maxSpeed=70;

steerAheadSimul=2;

steerAheadPlan=2;

predictTurnSimul=3;

predictTurnPlan=3;

      transportSoldier=13;

transportAmmo=30000;

displayName="Patrol Boat e";

accuracy=0.90;

fuelCapacity=500;

model="\OGNPBoat\schuna2b.p3d"

cost=2000000;

armor=300;

armorStructural=2.000000;

class Turrets: Turrets

{

class MyTurret: NewTurret

{

body = "OtocVez";

gun = "OtocHlaven";

// gunAxis="osahlavne";

// turretAxis="osaveze";

// animationSourceBody = "mainTurret";

// animationSourceGun = "mainGun";

// gunnerAction = "RHIB_Gunner";

castGunnerShadow = 1;

ejectDeadGunner = 1;

outGunnerMayFire = 1;

inGunnerMayFire = 1;

minElev = -25;

maxElev = 60;

soundServo[]={"\ca\wheeled\Data\Sound\servo3",0.000178,0.900000};

// initElev = 5;

// minTurn = -135;

// maxTurn = 135;

initTurn = 0;

gunBeg = "usti hlavne";

gunEnd = "konec hlavne";

weapons[] = {"M2"};

magazines[] = {"100Rnd_127x99_M2", "100Rnd_127x99_M2", "100Rnd_127x99_M2"};

gunnerName = $STR_POSITION_FRONTGUNNER;

gunnerOpticsModel = "\ca\weapons\optika_empty";

showgunneroptics = 1;

gunnerForceOptics = 0;

startEngine = 0;

gunnerAction="HMMWV_Gunner01";

class ViewGunner

{

initAngleX=5; minAngleX=-30; maxAngleX=30;

initAngleY=0; minAngleY=-100; maxAngleY=100;

initFov=0.700000; minFov=0.420000; maxFov=0.850000;

};

};

};

armorHull=1;

armorTurret=0.400000;

armorGun=0.200000;

armorEngine=0.400000;

};

Share this post


Link to post
Share on other sites

<span style='font-size:13pt;line-height:100%'>BINGO</span>

Thanks so much to TeRpEnTiN's extra assistance  notworthy.gif

It was a config issue (no surprise really)

Had to match the Animation names to the Body and Gun definitions in Turret def;

i.e.

Changed

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class Animations

{

class mainTurret //the horizontal moving part of the turret

{

..................

};

class mainGun //the vertical moving part of the turret

{

.................

};

to

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Animations

{

class OtocVez //the horizontal moving part of the turret

{

.......................

};

class OtocHlaven   //the vertical moving part of the turret

{

.......................

};

Because it obviously has to match this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class Turrets: Turrets

{

class MyTurret: NewTurret

{

body = "OtocVez";

gun = "OtocHlaven";

................................

Share this post


Link to post
Share on other sites

I've added this to my sandbox as a note. It's a bid strange that you have to use the exact selection name here but for everything else userdefinable names work fine.

On a sidenode, I hope I'll get the article finished in the near future, but I don't have enough time currently.

If there is some native or advanced english speaking person reading this here and has enough understanding of this part of editing I would be glad if they could enhance my bad english in the article.

Share this post


Link to post
Share on other sites

I think your article rocks, its well made and you should "publish" it instead of having it as sandbox mode, nothing wrong with the english either.

Anyone figured out how to solve the tracks then?

Guess have to give turrent one more chance now and watch my spelling wink_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×