Jump to content
Sign in to follow this  
giorox

Problem hiding selection from weapon when switching muzzles

Recommended Posts

So I am working on a FAL rifle grenade and I modeled both the rifle grenade and the grenade ladder sight into the normal rifle p3d.

I've gotten the ladder sight to animate correctly when switching muzzles (it folds up and down).
My problem is having the rifle grenade hidden when the muzzle is not selected and its not loaded, and then IF it is loaded and on the grenade launcher muzzle, to make it unhide.

Any help on how to do this? I tried using the weaponMuzzle source to hinde/unhide the grenade without worrying about it being loaded or not and I wasnt able to get it to work..

Here's my model.cfg entry for the rifle:
 

class GIX_FALGL
	{
		skeletonName="GIX_RifleBase";
		sections[]={"zasleh"};
		sectionsInherit="";
		class Animations
		{
			class trigger //Animate trigger pull
			{
				type="rotationZ"; 
				source="reload"; 
				selection="trigger"; 
				axis="trigger_axis"; 
				minValue=0; 
				maxValue="1"; 
				angle0="0"; 
				angle1="-0.5"; 
			};
			class safety_mode_rot
			{
				type			= "rotationZ";
				source			= "weaponMode";
				selection		= "safety";
				axis			= "safety_axis";
				memory			= 1;
				minValue		= 0;
				maxValue		= 0.25;
				angle0			= 0;
				angle1			= (rad 240);
			};
			class muzzleflash_hide //Remove muzzle flash if supressor is equipped
			{
    				type="hide";
    				source="hasSuppressor";
    				selection="zasleh";
    				minValue = 0.0;
    				maxvalue = 0.25;
    				hideValue = 0.01;
			};
			class magazine_hide
			{
				type="hide";
				source="reloadMagazine";
				sourceAddress="mirror";
				selection="magazine";
				minValue=0.0;
				maxValue=0.4;
				hideValue=0.5;
			};
			class bolt_empty //Animate bolt when weapon runs dry
			{
				type="translation";
				source="isEmpty";
				selection="bolt";
				axis="bolt_axis";
				memory=1;
				minValue=0.000000;
				maxValue=0.500000;
				offset0=0;
				offset1=0.5;
			};
			class bolt_catch
			{
				type="rotationZ"; 		//The type of animation.
				source="isEmpty";   		//The controller that provides input.
				selection="bolt_catch"; 	//The name of the skeleton bone used.
				axis="bolt_catch_axis"; 	//The name of the axis in the model.
				minValue=0; 			//The minimum value of the motion range. i.e. The controller input when animation phase is 0.
				maxValue="1"; 			//The maximum value of the motion range. i.e. The controller input when animation phase is 1.
				angle0="0";   			//The starting angle of this animation, where the animation phase is 0.
				angle1="rad -2.5"; 		//The ending angle of this animation, where the animation phase is 1.
			};
			class bolt_fire_begin
			{
				type="translation";
				source="reload";
				selection="bolt";
				axis="bolt_axis";
				memory=1;
				minValue=0.000000;
				maxValue=0.300000;
				offset0=0;
				offset1=0.5;
			};
			class bolt_fire_end:bolt_fire_begin
			{
				minValue=0.500000;
				maxValue=1.000000;
				offset0=0;
				offset1=-0.5;
			};
			class bolt_reload_begin
			{
				type="translation";
				source="reloadMagazine";
				selection="bolt";
				axis="bolt_axis";
				memory=1;
				minValue=0.1;
				maxValue=0.15;
				offset0=0;
				offset1=0.5;
			};
			class bolt_reload_end:bolt_reload_begin
			{
				minValue=0.980000;
				maxValue=1.000000;
				offset0=0;
				offset1=-0.5;
			};
			class zaslehROT
			{
				type="rotationX";
				source="ammoRandom";
				sourceAddress="loop";
				selection="zasleh";
				axis="";
				centerFirstVertex=1;
				minValue=0;
				maxValue=4;
				angle0="rad 0";
				angle1="rad 360";
			};
			class recoil
			{
				type="rotation";
				source="reload";
				selection="frame";
				axis="recoil_axis";
				sourceAddress = clamp;
				minValue = 0.05;
				maxValue = 0.75;
				angle0 = 0.0;
				angle1 = -0.10471976;
			};
			class no_magazine
			{
				type="hide";
				source="hasMagazine";
				selection="magazine";
				minValue=0.000000;
				maxValue=1.00000;
				hideValue=0.5;
				unhideValue = -1.0;
			};
			class OP_ROT
			{
				type="rotation";
				source="zeroing2";    // use second muzzle zeroing for rotation
				sourceAddress="loop"; // loop when phase out of bounds
				selection="OP";       // selection we want to rotate
				axis="OP_axis";       // has its own axis
				minValue=0;
				maxValue=2;
				angle0="rad 0";
				angle1="rad 65";
			};
			class GLSight_ROT
			{
				type="rotationZ";
				source="weaponMuzzle";    // use second muzzle zeroing for rotation
				sourceAddress="loop"; // loop when phase out of bounds
				selection="OP";       // selection we want to rotate
				axis="OP_axis";       // has its own axis
				minValue=0;
				maxValue=1;
				angle0="rad 0";
				angle1="rad 90";
			};
			class gl_tube_hide //Reveal the rifle grenade when muzzle = 1. Hide them when its is = 0.
			{
				type="hide";
				source="weaponMuzzle";
				selection="RifleGrenade";
				minValue = 0;
				maxvalue = 1;
				hideValue = 0.00;
				unhideValue = 0.01;

			};
		};
	};

 

Share this post


Link to post
Share on other sites
class CfgSkeletons
{
	class Default
	{
		isDiscrete=1;
		skeletonInherit="";
		skeletonBones[]={};
	};
	class uns_m1g_skel: Default
	{
		skeletonBones[]=
		{
			"zasleh", "",
			"magazine", "",
			"bullets", "magazine",
			"clip", "magazine",
			"trigger","",
			"bolt","",
			"ironsights","",
			"siderail","",
			"charging_handle",""
		};
	};
	class uns_m1garand_gl_base: uns_m1g_skel
	{
		isDiscrete=1;
		skeletonInherit="uns_m1g_skel";
		skeletonBones[]=
		{
			"adapter", "",
			"m8_gl", "",
			"grenade", ""
		};
	};	
};
class CfgModels
{
	class Default
	{
		sectionsInherit="";
		sections[]={};
		skeletonName="";
	};
	class uns_m1g_base: Default
	{
		sections[]=
		{
			"magazine","bullets","clip","charging_handle",
			"zasleh","bolt","trigger","ironsights","siderail"
		};
		skeletonName="uns_m1g_skel";
		class Animations
		{
			class trigger
			{
				type = "rotationZ";
				source = "reload";
				selection = "trigger";
				axis = "trigger_axis";
				minValue = 0;
				maxValue = 1;
				angle0 = "rad 0";
				angle1 = "rad -20";
			};
			class reload_clip_hide
           	{
				type="hide";
                source="reloadMagazine";
               	selection="clip";
                minValue=0;
                maxValue=1;
				hideValue = 0.1538461538;
				unhidevalue = 0.46153;
       		};
			class reload_bullets_hide
           	{
				type="hide";
                source="reloadMagazine";
               	selection="bullets";
                minValue=0;
                maxValue=1;
				hideValue = 0;
				unhidevalue = 0.46153;
       		};
/*
			class unloaded_magazine_hide
			{
				type = "hide";
				source = "hasMagazine";
				selection = "bullets";
				hideValue=0;
				unhideValue=0.4;
			};
*/
			class reload_magazine_clip_hinge
           	{
				type="translation";
                source="reloadMagazine";
               	selection="clip";
                minValue=0.1230769230;
                maxValue=0.153846153;
                axis="magazine_axis";
				begin = "bolt_axis_begin";
                end =  "bolt_axis_end";
				offset0 = 0;
				offset1 = 1.5;
            };
			class reload_magazine_bullets_hinge: reload_magazine_clip_hinge
           	{
               	selection="bullets";
            };		
			class reload_magazine_clip_hinge2: reload_magazine_clip_hinge
           	{
                minValue=0.46153846153;
                maxValue=0.5076923076;
				offset1 = -1.5;
            };		
			class reload_magazine_bullets_hinge2: reload_magazine_clip_hinge2
           	{
               	selection="bullets";
                minValue=0.46153846153;
                maxValue=0.5076923076;
				offset1 = -1.5;
            };		
			class charge1 //full draw on reload mag
			{
				type="translation";
				source="reloadMagazine";
				selection= "bolt";
				axis="bolt_axis";
				begin = "bolt_axis_end";
                end = "bolt_axis_begin";
				memory = 1;
				minValue=0.05;
				maxValue=0.12;
//				minValue=0.64613;
//				maxValue=0.684615;
				offset0="0";
				offset1="1";
			};
			class charge2: charge1
			{
				minValue=0.7384;
				maxValue=0.7538;
				offset0="0";
				offset1="-1";
			};
			class charging_handle_mag: charge1
			{
				selection="charging_handle";
			};
			class charging_handle_mag2: charge2
			{
				selection="charging_handle";
			};
			class bolt
			{
				type="translation";
				source="reload";
				selection="bolt";
				axis="bolt_axis";
				begin = "bolt_axis_end";
                end = "bolt_axis_begin";
				memory = 1;
				minValue=0;
				maxValue="0.5";
				offset0="0";
				offset1="1";
			};
			class bolt2: bolt
			{
				minValue=0.5;
				maxValue="1";
				offset0="0";
				offset1="-1";
			};
			class charging_handle_fire: bolt
			{
				selection="charging_handle";
//				axis="handle_axis";
//				maxValue="1";
//				offset0="0";
//				offset1="1";
			};
			class charging_handle_fire2: bolt2
			{
				selection="charging_handle";
//				axis="handle_axis";
//				maxValue="1";
//				offset1="-1";
			};
			class bolt_empty
			{
				type="translation";
				source = "isEmptyNoReload";
				selection="bolt";
				axis="bolt_axis";
				begin = "bolt_axis_end";
                end = "bolt_axis_begin";
				minValue = 0;
				maxValue = 1;
				offset0 = 0;
				offset1 = 1;
			};
			class handle_empty: bolt_empty
			{
				selection="charging_handle";
			};
			class bullets_empty
			{
				type = "hide";
				source = "isEmptyNoReload";
				selection="bullets";
				hideValue=0.1;
			};
			class backsight_hide
			{
				type="hide";
				source="hasOptics";
				selection="ironsights";
				animPeriod=0;
				minValue=0.0;
				maxValue=0.3;
				minPhase=0.0;
				maxPhase=0.3;
				hideValue=0.1;
				sourceAddress="mirror";
			};
			class siderails_hide
			{
				type="hide";
				source="hasAccessory";
				selection="siderail";
				animPeriod=0;
				minValue=0.0;
				maxValue=0.3;
				minPhase=0.0;
				maxPhase=0.3;
				hideValue=0.1;
				sourceAddress="mirror";
			};
            class MuzzleFlashROT
			{
				type="rotationX";
				source="ammoRandom";
				sourceAddress="loop";
				selection="zasleh";
				axis="barrel_axis";
				centerFirstVertex="true";
				minValue=0;
				maxValue=4;
				angle0="rad 0";
				angle1="rad 360";
			};
			class muzzleflash_hide
            {
				type="hide";
				source="hasSuppressor";
                selection="zasleh";
                minValue = 0.0;
                maxvalue = 0.25;
                hideValue = 0.01;
            };
    	};
	};
	class uns_m1garand: uns_m1g_base{};
	class uns_m1garand_gl: uns_m1g_base
	{
		sectionsInherit="uns_m1g_base";
		skeletonName="uns_m1garand_gl_base";
		sections[]=
		{
			"OP", "adapter", "grenade", "m8_gl"
		};
		class Animations: Animations
		{
			class 22mm_adapter_hide_fired
			{
				type="hide";
				source="revolving.1";
				selection="adapter";
				minValue=0.0;
				maxValue=1.0;
				hideValue=-1.0;
				unhideValue=0.5;
			};
			class 22mm_grenade_hide_fired: 22mm_adapter_hide_fired
			{
				selection = "grenade";
			};
//hide nade and adapter if muzzle is not selected
			class 22mm_m8_magazine_muzzle_hide
			{
				type="hide";
				source="weaponMuzzle";
				selection="m8_gl";
				minValue=0;
				maxValue=1;//2
				minPhase=0;
				maxPhase=1;
				hideValue=0;
				unhideValue=1;
				sourceAddress="mirror";
			};
			class 22mm_adapter_muzzle_hide: 22mm_m8_magazine_muzzle_hide
			{
				selection = "adapter";
			};
			class 22mm_grenade_muzzle_hide: 22mm_m8_magazine_muzzle_hide
			{
				selection = "grenade";
			};
		};
	};	
};

works like this

 

 

  • Like 1

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  

×