Jump to content
Sign in to follow this  
matt_baker1942

Model Config, Flip Sights for Ranging

Recommended Posts

Hey I was wondering if it was possible/ if anybody had any ideas on how to make a flip up sight for ranging. For example, this sight from a M1928 Thompson

WHSight.jpg

When the sights are ranged at their closest, the assembly is flipped down and uses a standard sight like so

600px-RS_ThompsonIronsights.jpg

Then when shooting furthur, the assembly flips up and the circular sight is used. I was wondering how I'd be able to do this in a model.cfg (assuming thats the best or only way). I figured the zeroing controller was the best bet, but what would need to be added to the model in order to make it work and ensure the sights are always aligned. Any feedback would be great thanks.

Share this post


Link to post
Share on other sites

I wondered about the same recently. I haven't made any investigations so far, but it should be entirely possible using the same system that is used for grenade launchers.

You need an eye memory point for every distance setting. The A3 Sample Model weapon (MX+grenadelauncher) should provide you with the stuff you need

In the end it comes down to placing the memory points, which might be a bit laborious (as you need to know angle of correction and exact ballistics of your bullet/gun for every setting ingame)

Edited by Fennek

Share this post


Link to post
Share on other sites

Not tried it myself yet but it's something I'm thinking of doing for the sights on one of my weapon models in future, so I've given it a LOT of thought, and planned out how to write the model.cfg.

I assume the basic premise of adding it would be much the same as the configuration described for GL sights in the BIS Weapon Guidelines; such that to keep the sights aligned you would add a memory point on top of the front ironsight post called for example "IRN_look" and assign a parameter for the weapon in the config cameraDir = "IRN_look";. Then you add a bunch of other memory points "IRN_eyeX" and a discreteDistanceCameraPoint[] = {"IRN_eye0", "IRN_eye1", "IRN_eye2", "IRN_eye3"... "IRN_eyeN"}; array to create an axis along which the sighted view looks down to "IRN_look" from each of those points for a given zeroing setting.

Getting the placement of the "IRN_eyeX" memory points in a way that matches the elevation required to look through aperture on the ladder sight as you adjust zero and animate the parts of the sight in the model.cfg might be a bit of a trial and error thing.

As for adding bits to the model in order to perform the animation itself, I'd assume you would require:

  • An axis to rotate the sight ladder around into the UP position when required (two verts in the memory lod forming a named selection called something like "IRN_ROT_axis")
  • An axis along the ladder, which the aperture slides up the as zeroing is increased (two verts in the memory lod forming a named selection called something like "IRN_SLIDE_axis")
  • A "bone" defining the ladder part of the sight assembly (assign a named selection like "IRN_ladder" for the ladder in your view Pilot LOD)
  • A "bone" defining the aperture part of the sight assembly (assign a named selection like "IRN_aperture" for the aperture in your view Pilot LOD)

Then in the model.cfg you would write the part of the cfg skeletons for the ironsights like this:

class CfgSkeletons
{
class My_Thompson
{
	pivotsModel="";
	isDiscrete = 0;
	skeletonInherit = "";
	skeletonBones[] =
	{
		"IRN_ladder","",
		"IRN_SLIDE_axis",	"IRN_ladder",
		"IRN_aperture","IRN_ladder"
	};
};
};

Here you have made the aperture bone (IRN_aperture) and the axis along which the aperture bone slides (IRN_SLIDE_axis), children of the ladder bone (IRN_ladder) such that when the ladder bone rotates around the axis "IRN_ROT_axis" into the UP position, the aperture and slide axis rotate into position along with it.

As for writing the animation, part of it depends on how you have written the discreteDistance[] = {}; array part of your config to describe the zeroing settings for the sight. discreteDistance array will be of the form discreteDistance[] = {index_0, index_1, index_2... index_N}; where index_X is a distance (e.g. 50, 100, 200, 300 meters) and index_N is the last entry in the array. Note that the index numbers start at 0 instead of 1, so you have [N+1] indexes in the array in total.

Then when it comes to writing the model.cfg we keep these index numbers in mind, and use them to assign the minValue/maxvalue targets for when to activate the animation. The animation controller (discreteDistance) will input values between 0 and N into the zeroing1 animation source; so we can make any given animation start (phase = 0) at a minvalue between 0 and N, and end (phase = 1) at a maxvalue between 0 and N.

So for our sights we need two animations in class Animations - one to flip up the ladder, and another to slide the aperture. Both will use the zeroing1 animation source so that both are controlled by the discreteDistance zeroing controller.

To flip up the ladder:

		class LadderROT
		{
			type="rotation";
			memory = 1;
			source="zeroing1";
			sourceAddress="clamp";
			selection="IRN_ladder";
			axis = "IRN_ROT_axis";
			minValue = "1";
			maxValue = "2";
			angle0 = "0";
			angle1 = "rad 90";
		};

In the above case we want the ladder to flip up when the zeroing is set to the third index value in the array (200m in my example), which has an index index_2; so we enter 2 as the maxvalue.

To make the sight flip up in an instant 90-degree rotation when you hit your desired zeroing value, you want the minvalue to be the index of the zeroing setting BEFORE the range at which you want the ladder to flip up, or a value between the index you want the sight to flip up at and the previous one. Ingame the discretedistance controller only passes integer values for the indexes so I could set it as minValue = 1.5; if I wanted and the effect of the animation wouldn't appear until zeroing got to index_2 because the controller wont pass any values between 1 and 2 - previewing the animation in buldozer is a different story though, since the [[] and []] keys increase the controller values continuously, not discretely. As long as minvalue != maxvalue it should work.

If I set minValue = 0; here, the ladder would be horizontal when zeroed at 50m (index_0), vertical when zeroed 200m (index_2) and somewhere in the middle (~45 degrees I guess) when zeroed to 100m (index_1).

Note that we are using the "IRN_ROT_axis" selection from our memory LOD as the axis for this rotation.

To Slide the Aperture up the ladder:

		class ApertureSLIDE
		{
			type="translation";
			memory = 1;
			source="zeroing1";
			sourceAddress="clamp";
			selection="IRN_aperture";
			axis = "IRN_SLIDE_axis";
			minValue = "2";
			maxValue = "N";
			offset0=0;
			offset1=0.1;
				animperiod=1;
		};

Here, the "IRN_aperture" slides a distance of 0.1 meters (difference between offset0 and offset1) along "IRN_SLIDE_axis" from its original position (where offset0 = 0).

Here minvalue is set to the index where the sight first flips up at index_2 (200m) and ends at the last index in the discrete distance array (index_N), whatever that might be. The aperture will slide incremental distances along the axis when the controller hits index_3, index_4, index_5 etc. all the way up to index_N, where it will stop and reach its maximum offset distance, 0.1m from the starting position which was where it was positioned at index_2. Obviously, in practise "N" will be a number, not a letter N ;)

Like I said before, you now have to add "IRN_eyeX" memory points for each of these indexes (IRN_eye0, IRN_eye1... IRN_eyeN) so that you have corresponding indexes in the discreteDistanceCameraPoint array, and they align with the aperture when each zeroing value is ticked off. Since in my example, the ladder doesn't flip up until index_2, I would likely use the same position for the memory points for index_0 and index_1 in my discreteDistanceCameraPoint[] = {}; array.

My only slight concern in all this is whether the discreteDistanceCameraPoint and cameraDir parameters really work on regular rifle type weapons firing bullets as it's not something I have tried yet in order to say for definite. I'm 99% confident that they should work though, since secondary GL muzzles are pretty much just a cfgweapons class of their own and I've seen people make standalone GLs like M32s, where the zeroing is done to the primary muzzle and the camera is made to move accordingly, with animating sights (using the zeroing1 source).

As ever, you can name your named selections (bones, axes, memory points) whatever the fuck you like - I'm just using IRN_blahblahblah because the notation would make sense to me in identifying those parts as bits of the IRoNsights assembly when modelling and configuring the weapon.

Edited by da12thMonkey

Share this post


Link to post
Share on other sites

I'm Working on this right now, I'll let you know if I get any success and maybe post a picture or two of it working (If it works :p)

Edit: okay initial results are ehh

so far the whole assembly just rotates incrementally.

Config:

			cameraDir = "IRN_look";
		discreteDistance[] = {50, 100, 200, 300, 400, 500, 600};
		discreteDistanceCameraPoint[] = {"eye", "IRN_eye2", "IRN_eye3", "IRN_eye4", "IRN_eye5", "IRN_eye6", "IRN_eye7"}; /// the angle of gun changes with zeroing
		discreteDistanceInitIndex = 0; /// 50 is the default zero

Model Cfg:

class CfgSkeletons
{
class Default
{
	 isDiscrete = 1;
	skeletonInherit = "";
	 skeletonBones[] = {};
 };
 class thompson_M1928_skeleton: Default
 {
	 skeletonInherit="";
	 skeletonBones[]=
	 {
		 "magazine","",
		 "trigger","",
		 "bolt","",
           		 "IRN_ladder","",
          		 "IRN_SLIDE_axis",    "IRN_ladder",
           		 "IRN_aperture","IRN_ladder"
	 };
 };
};
class CfgModels
{
 class Default
 {
	 sectionsInherit="";
	 sections[]={};
	 skeletonName="";
 };
 class thompson_M1928: Default
 {
	 sections[]=
	 {
		 "zasleh"
	 };
	 skeletonName="thompson_M1928_skeleton";
	 class Animations
	 {
		 class magazine_hide
		 {
			 type="hide";
			 source="reloadMagazine";
			 selection="magazine";
			 minValue=0.2;
			 maxValue=0.25;
			 hideValue=0.1;
		 };
		 class trigger
		 {
			 type="translationX";
			 source="reload";
			 selection="trigger";
			 axis="";
			 animPeriod=0;
			 memory="false";
			 minValue=0;
			 maxValue=0.016;
		 };
		 class bolt_action
		 {
			type="translation";
				source="reload";
				selection="bolt";
				axis="bolt_axis";
				begin="bolt_axis_begin";
			end="bolt_axis_end";
			sourceAddress = "loop";
				animPeriod=0.08571;
				minValue=0;
				maxValue=0.09;
				offset0="0";
				offset1="1";
		};
		class bolt_empty
		{
			type="translation";
			source="isempty";
			selection="bolt";
				axis="bolt_axis";
				begin="bolt_axis_begin";
				end="bolt_axis_end";
				animPeriod=0;
				minValue=0;
				maxValue=0.09;
				offset0="0";
				offset1="1";
		};
		class LadderROT
		{
			type="rotation";
			memory = 1;
			source="zeroing1";
			sourceAddress="clamp";
			selection="IRN_ladder";
			axis = "IRN_ROT_axis";
			minValue = "0";
			maxValue = "1";
			angle0 = "0";
			angle1 = "rad -90";
		};
		class ApertureSLIDE
		{
			type="translation";
			memory = 1;
			source="zeroing1";
			sourceAddress="clamp";
			selection="IRN_aperture";
			axis = "IRN_SLIDE_axis";
			minValue = "1";
			maxValue = "6";
			offset0=0;
			offset1=0.1;
			animperiod=1;
		}; 
	};
};
};

don't know what could be wrong. Although I found out apparently there's no 50m configuration for sights :/ even though that's what I want the sights folded down at and then flipped up for 100 - 600.

EDIT:

Nevermind I fixed the ranges, but the problem is still the same, the whole sight rotates little by little for each distance until it reaches 90 degrees. I think it has something to do with the source, or the min/max values. Even though I set the values to what should be correct, it doesnt seem to following anything resembling what it should.

Edited by Matt_Baker1942

Share this post


Link to post
Share on other sites

Ah, that's disappointing.

Is the aperture sliding in sync with the ladder the whole time as it raises; even though they have different min/max values, or does it not start sliding at all?

Share this post


Link to post
Share on other sites

I fixed it! I changed the max and min values.

			class LadderROT
		{
			type="rotationZ";
			memory = true;
			source = "zeroing1";
			sourceAddress = "clamp";
			selection = "IRN_Ladder";
			axis = "IRN_ROT_axis";
			minValue= 0;
			maxValue= 0.125;
			angle0 = "0";
			angle1 = "rad 90";
		};
		class ApertureSLIDE
		{
			type="translation";
			memory = true;
			source="zeroing1";
			sourceAddress="clamp";
			selection="IRN_Aperture";
			axis = "IRN_SLIDE_axis";
			minValue = 0.125;
			maxValue = 1.00;
			offset0=0;
			offset1=1.75;
		}; 

For some reason I thought screw it and made the max value it reaches as 1 instead of 8. so for the sights to flip up when it goes to the next range, its the first of 8 values so the max is 1/8th. Then the sliding part activates the next 7/8th so its from 1/8th to 1. And it works! I could try and post a video if anybody wants to see it, but the model isn't mine and although I don't intend to release it, I don't wanna break any forum rules.

Share this post


Link to post
Share on other sites

Great!

My next suggestion was going to be to change the values from 0-N integers corresponding to the indexes, to n/N or (n/N+1) decimals - which was why I asked if the sliding movement had started by the time the ladder was rotated. If it didn't start sliding with a minvalue greater than the maxvalue of the rotation anim, it would have suggested that the source only inputs values between 0 and 1.

Most sources seems to use min/max values between 0 and 1, so perhaps the way the guide for GL sights is written on the biki is misleading when it says:

new animation controllers zeroing1 and zeroing2 take values from discreteDistance[] of first and second muzzle of the weapon. The value is index number of current zeroing in the array starting with zero (that means the first value is 0, second is 1, the last is number of discrete distances plus one). It might be used for iron sights of the weapon if desired but better use is for UGL collimator sights rotation:

How many range indexes are in your discreteDistance[] array if you're using n/8 to calculate the min/max values? Is it 7, 8 or 9 different zeroing ranges long?

Share this post


Link to post
Share on other sites

Its discreteDistance[]={50, 50, 100, 200, 300, 400, 500, 600} so 8 of them. I have two 50m distances so you can choose to have the sights down or up at 50m. I'll make a video and post anyway, kinda proud of how it turned out.

Edit: Here's a little video

Edited by Matt_Baker1942

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  

×