Jump to content
Sign in to follow this  
ikerdo

muzzleflash rotation

Recommended Posts

I am using the sample model.cfg, but I have a problem with the muzzleflash rotation. In 02 it is ok, but ingame It won´t rotate on its axis. It is rotating in a circle. I´ve tried to add a custom axis, but it doesn´t work.

class CfgSkeletons
{
class Test_Weapon
{
	pivotsModel="";
	isDiscrete = 0;
	skeletonInherit = "";
	skeletonBones[] =
	{
		"trigger",		"", /// not in this model, but good to use
		"bolt",			"",
		"bolt_catch",	"",
		"magazine",		"",
		"safety",		"",
		"muzzleFlash",	"",
		"OP",			"",
		"ForeSight",	"",
		"BackSight",	""
	};
};
};
class CfgModels
{
class Default;
class Optic: Default
{
	sections[]=
	{
		"zasleh"
	};
};
class Weapon: Default
{
	sections[]=
	{
		"zasleh"
	};

	htMin = 1;		// Minimum half-cooling time (in seconds)
	htMax = 600;	// Maximum half-cooling time (in seconds)
	afMax = 0;		// Maximum temperature in case the model is alive (in celsius)
	mfMax = 0;		// Maximum temperature when the model is moving (in celsius)
	mFact = 1;		// Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)).
	tBody = 100;	 // Metabolism temperature of the model (in celsius)

	skeletonName="Weapon";
	class Animations
	{
		class zaslehROT
		{
			type="rotation";
			source="clockMinute";
			sourceAddress="loop";
			selection="zasleh";
			begin="usti hlavne";
			end="konec hlavne";
			memory=1;
			minValue=0.0166665;
			maxValue=0.016666666666666666666666666666667;
			angle0="rad 0";
			angle1="rad 360";
		};
		class magazine_hide
		{
			type="hide";
			source="reloadMagazine";
			sourceAddress="mirror";
			selection="magazine";
			minValue=0.0;
			maxValue=0.4;
			hideValue=0.5;
		};
		class reload_ammobelt_hide: magazine_hide
		{
			selection="ammo_belt";
		};
		class reload_ammobelt_bottom_hide: magazine_hide
		{
			selection="ammo_belt_bottom";
		};
		class ammobelt_hide: magazine_hide
		{
			source="isEmpty";
			selection="ammo_belt";
			minValue=0.000000;
			maxValue=1.000000;
			hideValue=1.000000;
		};
		class ammobelt_bottom_hide: ammobelt_hide
		{
			selection="ammo_belt_bottom";
		};
		/// Hiding of magazine if weapon has none
		class no_magazine
		{
			type="hide";
			source="hasMagazine";
			selection="magazine";
			minValue=0.000000;
			maxValue=1.00000;
			hideValue=0.5;
			unhideValue = -1.0;
		};				
	};
};
class Rifle: Weapon
{
	skeletonName="Rifle";
	class Animations: Animations
	{
		class magazine_hide:magazine_hide
		{
			sourceAddress="mirror";
			minValue=0.0;
			maxValue=0.56;
			hideValue=0.36;
		};
		class bolt_empty
		{
			type="translation";
			source="isEmpty";
			selection="bolt";
			axis="bolt_axis";
			memory=1;
			minValue=0.000000;
			maxValue=0.500000;
			offset0=0;
			offset1=0.5;
		};
		class bullet_cover
		{
			type="rotation";
			source="reload";
			sourceAddress="mirror";
			selection="bullet_cover";
			axis="bullet_cover_axis";
			memory=1;
			minValue=0.0;
			maxValue=0.5;
			angle0=0;
			angle1=-0.4;
		};
		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 Test_WeaponBase: Rifle
{
	skeletonName = "Test_Weapon";
	sectionsInherit = "";
	sections[] = {"muzzleFlash","Camo"};
	class Animations
	{
		class trigger /// not in this model, but good to use
		{
			type = "rotation";
			source = "reload";
			sourceAddress = "clamp";
			selection = "trigger";
			axis = "trigger_axis";
			minValue = 0;
			maxValue = "1";
			angle0 = "0";
			angle1 = "rad -30";
		};

		class bolt
		{
			type = "translation";
			source = "reload";
			sourceAddress = clamp;
			selection = "bolt";
			axis = "bolt_axis";
			minValue = 0.5;
			maxValue = 1;
			offset0 = 0;
			offset1 = 0.3;
		};
		class bolt_2: bolt
		{
			minValue = 0;
			maxValue = 0.5;
			offset0 = 0;
			offset1 = 0.7;
		};
		class bolt_empty: bolt{
			source = "isEmptyNoReload";
			minValue = 0;
			maxValue = 1;
			offset0 = 0;
			offset1 = 1;
		};
		class bolt_reload_move_1: bolt_empty {
			source="reloadMagazine";	// z: should work like that only if weapon is empty
			minValue=0;
			maxValue=0.00001;
		};
		class bolt_reload_move_2: bolt_reload_move_1 {
			source="reloadMagazine";	// z: should work like that only if weapon is empty
			minValue=0.78;
			maxValue=0.80;
			offset1 = -1;
		};
		class bolt_catch: bolt {
			selection = "bolt_catch";
			axis = "bolt_catch_axis";
		};
		class bolt_catch_2: bolt_2 {
			selection = "bolt_catch";
			axis = "bolt_catch_axis";
		};
		class bolt_catch_empty: bolt_empty {
			selection = "bolt_catch";
			axis = "bolt_catch_axis";
		};
		class bolt_catch_reload_move_1: bolt_reload_move_1 {
			selection = "bolt_catch";
			axis = "bolt_catch_axis";
		};
		class bolt_catch_reload_move_2: bolt_reload_move_2 {
			selection = "bolt_catch";
			axis = "bolt_catch_axis";
		};
		class magazine_hide
		{
			type="hide";
			source="reloadMagazine";
			selection="magazine";
			minValue=0.000000;
			maxValue=1.00000;
			hideValue=0.188;
			unhideValue = 0.550;
		};
		class no_magazine
		{
			type="hide";
			source="hasMagazine";
			selection="magazine";
			minValue=0.000000;
			maxValue=1.00000;
			hideValue=0.5;
			unhideValue = -1.0;
		};
		class magazine_reload_move_1
		{
			type = "translation";
			source = "reloadMagazine";
			selection = "magazine";
			axis = "magazine_axis";
			minValue = 0.145;
			maxValue = 0.170;
			offset0 = 0.0;
			offset1 = 0.5;
		};
		class magazine_reload_move_2: magazine_reload_move_1
		{
			minValue = 0.573;
			maxValue = 0.602;
			offset0 = 0.0;
			offset1 = -0.5;
		};

		class muzzleFlashROT
		{
			type="rotationX";
			source="ammoRandom";      //use ammo count as phase for animation
			sourceAddress="loop";     //loop when phase out of bounds
			selection="muzzleFlash";  //selection we want to rotate
			axis="";                  //no own axis - center of rotation is computed from selection
			centerFirstVertex=true;   //use first vertex of selection as center of rotation
			minValue=0;
			maxValue=4;               //rotation angle will be 360/4 = 90 degrees
			angle0="rad 0";
			angle1="rad 360";
		};
		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=3;
			angle0="rad 0";
			angle1="rad 65";
		};
		class BackSight_optic
		{
			type="rotation";
			source="hasOptics";
			selection="BackSight";
			axis="BackSight_axis";
			memory=1;
			minValue=0.0000000;
			maxValue=1.0000000;
			angle0=0.000000;
			angle1=(rad 90);
		};
		class ForeSight_optic: BackSight_optic
		{
			selection="ForeSight";
			axis="ForeSight_axis";
			angle1=(rad 90);
		};

	// Rotation of fire mode switch
		class safety_mode_rot
		{
			type			= rotation;
			source			= weaponMode;
			selection		= "safety";
			axis			= "safety_axis";
			memory			= 1;
			minValue		= 0;
			maxValue		= 0.25;
			angle0			= 0;
			angle1			= (rad -52);
		};
	};
};
class Test_weapon_01_F: Test_WeaponBase {};
};

Share this post


Link to post
Share on other sites

this is the problem.

As u can see I have the same problem with the barrels,. Sould I edit something in the .cpp?

Share this post


Link to post
Share on other sites

Looking at your model config I'd try changing "memory = 1;" to "memory = 0;" in the zasleh rotation animation.

At present you're defining the axis in your model config not the memory lod.

Alternatively, create a selection in your memory LOD containing the points you want to use as your axis and name it.

Reference that with "axis = "zasleh_axis";", or whatever you decide to name the relevant axis, in the appropriate animations.

If you are not intending for the barrel/s to rotate, double check it is not part of the zasleh selection in any of the model LODs.

However, given it's apparently meant to be a minigun the issue I mention above is likely the culprit and is likely solved using the same method.

Share this post


Link to post
Share on other sites

Ok, now it is working because I hit "center all" in O2, but the weapon is nearly in the floor. But if I move it, it will fail again.

---------- Post added at 19:59 ---------- Previous post was at 19:22 ----------

This is how it looks now. How can I edit the centering point?

Edited by ikerdo

Share this post


Link to post
Share on other sites

Make sure you have the Autocenter = 0 named property in the Geometry LOD of your weapon (ctrl+1 will toggle the named properties window in OB).

Share this post


Link to post
Share on other sites

Yeah!! THat was it. I didn't even know about named properties.Thx!!!:)

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  

×