Jump to content
riten

[FIXED: bones Issue] Turret & Gunner optics problem

Recommended Posts

Need some help to find bug in my cfg, I'm trying to make gunner optic in my plane. When I switch to gunner optics I can only watch up/down, but in 3d buldozer & game, "gun" model moves in all directions perfectly. I was trying to find out for serveal hours why it doesn't works corectly in gunner optics. I was checking my memory lod names and config few times, need someone's "fresh eye" for this.

 

Config.cpp turret:

class NewTurret;
		class Turrets
		{
			class MainTurret: NewTurret
			{
				/*
				weapons[] = {"Twin_Cannon_20mm","missiles_Zephyr","missiles_ASRAAM","CMFlareLauncher"};
		        magazines[] = {"300Rnd_20mm_shells","2Rnd_AAA_missiles","4Rnd_GAA_missiles","120Rnd_CMFlare_Chaff_Magazine"};
				*/
				weapons[] = {"Laserdesignator_mounted"};
				magazines[] = {"Laserbatteries"};
				commanding = -1;
				GunnerAction = "Plane_Fighter_03_pilot";
				GunnerInAction = "Plane_Fighter_03_pilot";
				isCopilot = 1;
				gunnerName = "Gunner";
				primaryGunner = 1;
				primaryObserver = 1;
				proxyType="CPGunner";
				proxyIndex = 1;
				CanEject = "true";
				memoryPointsGetInGunner = "pos gunner";
				memoryPointsGetInGunnerDir = "pos gunner dir";
				castGunnerShadow = 1;
				viewGunnerShadow = 1;
				/*
				gunnerLeftHandAnimName = "throttle_rear";
				gunnerRightHandAnimName = "stick_rear";
				gunnerleftleganimname = "pedal_rear";
				gunnerrightleganimname = "pedal_rear";
				*/
				maxHorizontalRotSpeed = 8.2;
				maxVerticalRotSpeed = 8.2;
				stabilizedInAxes = 0;
				startEngine = 0;
				body = "OtocVez";
				gun = "OtocHlaven";
				animationSourceBody = "OtocVez";
				animationSourceGun = "OtocHlaven";
				minElev = -90;
				maxElev = 15.0;
				initElev = -45;
				minTurn = -350;
				maxTurn = 350;
				/*gunStabilized = true;*/
				initTurn = 0;
				soundServo[] = {"",0.01,1};
				outGunnerMayFire = 1;
				inGunnerMayFire = 1;
				gunBeg = "usti hlavne";
				gunEnd = "konec hlavne";
				memoryPointGunnerOptics = "usti hlavne";
				selectionFireAnim = "";
				turretInfoType = "RscOptics_UAV_gunner";
				gunnerForceOptics = 0;
					
				
				class OpticsIn
				{
					class Wide
					{
						opticsDisplayName = "W";
						initAngleX = 0;
						minAngleX = -360;
						maxAngleX = 360;
						initAngleY = 0;
						minAngleY = -350;
						maxAngleY = 350;
						initFov = 0.7;
						minFov = 0.03;
						maxFov = 1.2;
						directionStabilized = 0;
						horizontallyStabilized = 0;
						stabilizedInAxes = 3;
						visionMode[] = {"Normal","NVG","Ti"};
						thermalMode[] = {0,1};
						gunnerOpticsModel = "A3\drones_f\Weapons_F_Gamma\Reticle\UGV_01_Optics_Gunner_F.p3d";
					};
					class Medium: Wide
					{
						opticsDisplayName = "M";
						initFov = 0.093;
						minFov = 0.093;
						maxFov = 0.093;
						gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_medium_F";
						directionStabilized = 1;
						horizontallyStabilized = 1;
						stabilizedInAxes = 3;
					};
					class Narrow: Wide
					{
						opticsDisplayName = "N";
						gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F";
						initFov = 0.029;
						minFov = 0.029;
						maxFov = 0.029;
						directionStabilized = 1;
						horizontallyStabilized = 1;
						stabilizedInAxes = 3;
					};
				};
				class OpticsOut
				{
					class ViewGunner
					{
						stabilizedInAxes = 0;
						directionStabilized = 0;
						horizontallyStabilized = 0;
						initFov = 1;
						minFov = 0.6;
						maxFov = 0.85;
						initAngleX = 0;
						minAngleX = -35;
						maxAngleX = 85;
						initAngleY = 0;
						minAngleY = -130;
						maxAngleY = 130;
						minMoveX = -0.2;
						maxMoveX = 0.2;
						minMoveY = -0.025;
						maxMoveY = 0.1;
						minMoveZ = -0.2;
						maxMoveZ = 0.2;
						visionMode[] = {"Normal","NVG"};
						gunnerOpticsModel = "";
						gunnerOpticsEffect[] = {};
					};
				};
			};
		};

Model.cfg

                        class OtocVez 
			{
			type="rotationY";
			source="OtocVez";
			selection="OtocVez";
			axis="osa veze";
			animPeriod=0;
			memory=1;
			minValue="rad -360";
			maxValue="rad +360";
			angle0="rad -360";
			angle1="rad +360";
			};

			class OtocHlaven 
			{
			type="rotationX";
			source="OtocHlaven";
			selection="OtocHlaven";
			axis="osa hlavne";
			animPeriod=0;
			memory=1;
			minValue="rad -90";
			maxValue="rad +90";
			angle0="rad -90";
			angle1="rad +90";
			};

Share this post


Link to post
Share on other sites

I've found out that if I declare "OtocVez" first, I can move my turret optics up/down, if "OtocHlaven" is higher in bones then I can view only left/right. Any ideas what that may be? Gun model moves corectly, but gunner optics is locked to one axis... 

class CfgSkeletons
{
	class cfgVehicles;
	class L159_ACR: cfgVehicles
	{
		isDiscrete=0;
		skeletonInherit="";
		skeletonBones[]=
		{
			"rotor","",
			"flapL","",
			"flapR","",
			"elevatorL","",
			"elevatorR","",
			"rudder","",
			"rudder_Small","rudder",
			"aileronL","",
			"aileronR","",
			"airbrake1","",
			"airbrake2","",
			"canopy1","",
			"canopy2","",
			"gear_1_hatch_1","",
			"gear_1_hatch_2","",
			"gear_1","",
			"gear_1_steering","gear_1",
			"gear_1_Steering2","gear_1",
			"gear_1_damper","gear_1_steering",
			"gear_1_stabil_1","gear_1_steering",
			"wheel_1","gear_1_stabil_1",
			"gear_2","",
			"gear_2_damper","gear_2",
			"gear_2_stabil","gear_2",
			"wheel_2","gear_2_stabil",
			"gear_2_hatch","",
			"gear_3","",
			"gear_3_damper","gear_3",
			"gear_3_stabil","gear_3",
			"wheel_3","gear_3_stabil",
			"gear_3_hatch","",
			"ladder","",
			"ladder_1","",
			"rpm1","",
			"rpm2","",
			"rpm3","",
			"rpm4","",
			"rpm5","",
			"rpm6","",
			"rpm7","",
			"rpm8","",
			"kompas1","",
			"sekundova","",
			"climb","",
			"speed","",
			"fuel","",
			"monitory","",
			"pilot_stick","",
			"pilot_throttle","",
			"OtocHlaven","",
			"OtocVez",""	
		};
	};
};

Share this post


Link to post
Share on other sites

verify the axis, selection, class names etc (use Dep3d from mikero)

get sample configs and model.cfg from BI and CUP to compare

Share this post


Link to post
Share on other sites

Also, your formatting is a mess. Bones are defined in pairs so put the pairs on the same line:

		skeletonBones[]=
		{
			"rotor", "",
			"flapL", "",
			"flapR", "",
			"elevatorL", "",
			"elevatorR", "",
ETC...

It makes the code so much easier to read, and its easier to spot inheritance issues.

Share this post


Link to post
Share on other sites

@.kju
As I said I've spent serval hours trying find out what may be wrong with model/cfg, so I wouldn't ask for help without any effort. I'll give more informations about my selections so maybe someone will be able to figure out what is going on with my optics.. I've also checked sample models/configs.
 
1. OtocHlaven & OtocVez selections (they are the same):

mTJ987q.png


 
----------------- Memory LODS---------------------
2. Gunnerview

C3x76f0.png


3. Usti Hlavne & Konec Hlavne

fR6xeeo.png


4. Nabojniceend/start

vmruXpy.png


5. OsaVeze (axis)

RJHnZS2.png


6. OsaHlavne (axis)

JxEOEvV.png


7. OtocVez 

kq78nqE.png


8. OtocHlaven

n5CAPQT.png


 
Object builder + in-game test:
https://www.youtube.com/watch?v=DNo00ebinXs&feature=youtu.be
 
@Jackal326
 
It is my first mod, I took model.cfg from BI samples. I thought that they know what they do with "formatting", but now when I understand more I'm sure ur right about it. Thanks for helpful advice.

Share this post


Link to post
Share on other sites

 

            "OtocHlaven","",

            "OtocVez",""   

One needs to be parent of the other.

"OtocVez",""    
"OtocHlaven","OtocVez",
  • Like 1

Share this post


Link to post
Share on other sites

 

One needs to be parent of the other.

"OtocVez",""    
"OtocHlaven","OtocVez",

 

That works now! I was trying everything, but didn't tried this one before. Thanks for helping me fix this :)

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

×