Jump to content
Sign in to follow this  
Bnae

Handgun

Recommended Posts

Hello,

 

Firstly,

I'm trying to figure out how to set the correct size for the weapon after exporting from Blender to Object Builder.

Of course i can scale it, but how do i know it's correct size without building it into a addon and trying it ingame?

 

Secondly,

I have bolt, magazine and trigger on my model. I cannot find how to animate the bolt and trigger action while shooting.

If i have guess i would say mempoints and so on.

 

Any hints/ tips/ tutorials are wellcome.

Share this post


Link to post
Share on other sites

1 grid unit in Object Builder = 1 meter ingame. If you're building on object in other software with grid units set to cm scale or inch scale or whatever, you can pick the appropriate scale factor from the import menu.

 

Otherwise you can create a reference cube in Object Builder (\Create\Box\ from the toolbar or press the [F7] key) and enter the dimensions you want the object to have.

e.g. you know your handgun should be 17cm long so enter 0.17 (17cm = 0.17m) in the "Size" fields in the Create Box menu, then scale your handgun to fit inside the bounds of the box. Then delete the box when you want to save the .p3d

Share this post


Link to post
Share on other sites

1 grid unit in Object Builder = 1 meter ingame. If you're building on object in other software with grid units set to cm scale or inch scale or whatever, you can pick the appropriate scale factor from the import menu.

 

Otherwise you can create a reference cube in Object Builder (\Create\Box\ from the toolbar or press the [F7] key) and enter the dimensions you want the object to have.

e.g. you know your handgun should be 17cm long so enter 0.17 (17cm = 0.17m) in the "Size" fields in the Create Box menu, then scale your handgun to fit inside the bounds of the box. Then delete the box when you want to save the .p3d

 

Excellent, thanks for the quick and simple answer!

Share this post


Link to post
Share on other sites

I'm still trying to figure out how to make the slider go back while firing. Cannot find anything about the topic.

Share this post


Link to post
Share on other sites

Its all to do with a file called a model.cfg

If you're unfamiliar with 'named selections' in Object Builder as well as the memory LOD, I'll try to explain things as I go:

 

Firstly you need to create a file called model.cfg (create a new .txt file and rename the extension)

Within that file you need to define the skeleton and the model itself. The skeleton is a list of all the parts (or bones) of the model that animate and looks something like this:

class CfgSkeletons
{
	class Default
	{
		isDiscrete = 1;
		skeletonInherit = "";
		skeletonBones[] = {};
	};
	class YOURTAG_HandgunBase: Default
	{
		skeletonBones[]=
		{
			"magazine", 		"",
			"bullet", 		"magazine",
			"magazine_release", 	"",
			"trigger", 		"",
			"hammer", 		"",
			"slide", 		"",
			"slide_catch", 		"",
			"zasleh", 		""
		};
	};
};

Then comes the cfgModels section, this is where the animations are defined. I'll define a few basic ones for you, but there are more advanced things you can do with the system too:

class CfgModels
{
	class YOURTAG_HandgunModelBase
	{
		skeletonName="YOURTAG_HandgunBase";
		class Animations
		{
			class muzzleflash_hide
			{
    				type="hide"; // THIS WHOLE ANIMATION HIDES THE MUZZLE-FLASH WHEN A SUPPRESSOR IS ATTACHED
    				source="hasSuppressor"; 
    				selection="zasleh";
    				minValue = 0.0;
    				maxvalue = 0.25;
    				hideValue = 0.01; 
			};

			class trigger 
			{
				type="rotationZ"; // ANIMATES THE TRIGGER WHEN THE WEAPON IS FIRED
				source="reload"; 
				selection="trigger"; // NAMED SELECTION IN THE MODEL
				axis="trigger_axis";  // TWO (2) MEMORY POINTS WITHIN THE MEMORY LOD THAT HAVE THE NAMED SELECTION 'trigger_axis'
				minValue=0; 
				maxValue="1"; 
				angle0="0"; 
				angle1="-0.5"; 
			};

			class hammer
			{
				type="rotationZ"; //The type of animation.
				source="reload";   //The controller that provides input.
				selection="hammer"; //The name of the skeleton bone used.
				axis="hammer_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="63"; //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="-63"; //The ending angle of this animation, where the animation phase is 1.
			};

			class slide
			{
				type="translation"; 		// The type of animation.
				source="reload";   		// The controller that provides input.
				selection="slide"; 		// The name of the skeleton bone used.
				begin="slide_axis_begin";       // A MEMORY POINT IN THE MEMORY LOD THAT MARKS THE BEGIN OF THE SLIDE'S MOVEMENT
				end="slide_axis_end";           // A MEMORY POINT IN THE MEMORY LOD THAT MARKS THE END OF THE SLIDE'S MOVEMENT
				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.
				offset0="0";
				offset1="1";
			};

			class slide_back:slide
			{
				source="isEmpty";   		//The controller that provides input. - LOCKS SLIDE BACK WHEN EMPTY
			};

			class reload_magazine_hide
			{
				type="hide";
				source="reloadMagazine";
				selection="magazine";
				hidevalue=0.22;
			};

			class reload_magazine
			{
				type="rotationZ"; // The type of animation.
				source="reloadMagazine";   // The controller that provides input.
				selection="magazine"; // The name of the skeleton bone used.
				axis="magazine_axis";                  // The name of the axis in the model.
				minValue="0.15"; // The minimum value of the motion range. i.e. The controller input when animation phase is 0.
				maxValue="0.5"; // 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 -1.5"; // The ending angle of this animation, where the animation phase is 1.
			};

			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;
			};
		};
		sections[]={"zasleh"};
		sectionsInherit="";
	};
	YOURMODELNAME_WITHOUTP3D_EXTENSION: YOURTAG_HandgunModelBase {};
};

There are a few pages on the WIKI that I would advise you read too: Model.cfg, CfgSkeletonsAnimations and How to animate a model

Share this post


Link to post
Share on other sites

Thanks Jackal326! Yea i have a working gun, with reload anim and bolt back while empty. The problem was that i didnt find the mempoint names and i didn't have any idea how to create the animations without help. I also luckily created the model with multiple skelebones. I'll try this later today when i get to my computer.

Share this post


Link to post
Share on other sites

Thanks Jackal326! Yea i have a working gun, with reload anim and bolt back while empty. The problem was that i didnt find the mempoint names and i didn't have any idea how to create the animations without help. I also luckily created the model with multiple skelebones. I'll try this later today when i get to my computer.

Cool, let me know how you get on, and if you have any questions post them up and I (or someone else if they beat me to it) should be able to help out :)

Share this post


Link to post
Share on other sites
class bolt_fired
{
	type="translation";
	source="reload";
	selection="bolt";
	memory=1;
	sourceAddress="clamp";
	minValue=0;
	maxValue=1;
	begin="bolt_start";
	end="bolt_end";
	offset0=0;
	offset1=1;
};
class slider_fired : bolt_fired
{
	selection="upper_reciever";
};

Names are correct and both are defined in the skeletonbones and sections and still only the bolt moves?

Otherwise everything is working like a charm

 

UPDATE:

 

Everything is working just fine now. Only thing that is still missing is zasleh

Share this post


Link to post
Share on other sites

Everything is working just fine now. Only thing that is still missing is zasleh

I'm glad to hear it. You'll need to create a proxy of the correct muzzle-flash (Create > Proxy > Browse > \A3\data_f\proxies\muzzle_flash\muzzle_flash_pistol (or similar, there are a few to choose from)).

You'll then need to give it the 'zasleh' named selection and position it correctly relative to the model.

Share this post


Link to post
Share on other sites

I'm glad to hear it. You'll need to create a proxy of the correct muzzle-flash (Create > Proxy > Browse > \A3\data_f\proxies\muzzle_flash\muzzle_flash_pistol (or similar, there are a few to choose from)).

You'll then need to give it the 'zasleh' named selection and position it correctly relative to the model.

 

Thanks!

I just realized that there was Arma 3 Samples in the steam tools. I think these samples will explain everything aswell, atleast i hope so.

Thanks again for helping.

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  

×