Jump to content
Sign in to follow this  
b00ce

[Tutorial] Creating Custom Weapon Animations

Recommended Posts

Creating custom hand animations for weapons is a topic not covered in any dedicated tutorials, any question on the subject is always answered by pointing to any of a number of threads that can be vague to a budding addon maker. Hopefully with this tutorial, everything will be clear, concise and easy.

Requirements:

  • A weapon model that you made.
  • The BISkeleton
  • A basic understanding of Oxygen

Step 1: Make a copy of the BISkeleton model and place it somewhere in your addon folder in your P: drive as *Weapon*_anim.p3d, for this example I saved my animation in “P:\m41a_Pulse_Rifle\data\Animbase\PulseRifle_anim.p3dâ€. This serves two purposes; first, it prevents you from accidentally overwriting your original and second allows you to save and then easily tweak the animation at a later time.

Step 2: Open the copy of the BISkeleton you saved in your addon folder with Oxygen and create two new keyframes and name them -0.5000 and 0.0000. Make 0.0000 the active keyframe by double clicking on it. Now is also the time you would paste your weapon model into O2 as well, you will need to rotate it 90 degrees on the Y axis.

th_01.png

(Note: The position of the weapon does not matter.)

Step 3: Select each hand (Via -LeftHand and -RightHand) and move/rotate them to their respective positions on the weapon. Make a note of which direction the palm is facing. Use the axis locks to make moving and rotating easier.

th_02.png

Step 4: Once your hands are in the correct position, you need to turn on “Show Local Axis†(Seen in the image below). This makes the fingers bend where/how they should if you have the axises selected.

  • X Axis: Curls the finger joint.
  • Y Axis: Rotates the finger joint, this doesn't look natural in most cases.
  • Z Axis: Allows you to spread the fingers, use this only on the first joint to get the finger in a natural position.

Form the fingers how you feel they should be (Keep the trigger finger straight, only bend the first joint at most), this takes a lot of tweaking and fine tuning, but I can't tell you how to make custom hand grips, its an art, not a science. But as a piece of advise, it turns out best if you look at your hands while you hold things, preferably something weapon shaped. ;)

th_03.png

Step 5: Move the “weapon†bone (The M16a4 that was already in the Skeleton model) to match where the trigger guard of your gun is. (See below) Once they're lined up select your gun and delete it, right clicking on the selection box and clicking “Delete Emptyâ€. Once this is done, with the 0.0000 key frame selected, create a new key frame and name it 1.0000. Save the .p3d then right click on the keyframe window and at the very bottom there is an Export Matracies option, click it and save it in the folder above Animbase. (EX. “P:\m41a_Pulse_Rifle\data\\PulseRifle_anim.rtmâ€) Make sure to include .rtm in the file name or it will not work. A dialogue should now pop up, hit cancel. Your custom hand animation has now been saved, congrats.

th_04.png

Step 6: Get a copy of a model.cfg for character models (One with the bones for people in it.) and paste it in the folder with the .rtm; below is an example.

EX.

class CfgSkeletons

{

class Head

{

isDiscrete = 0;

skeletonInherit = "";

skeletonBones[] =

{

"neck","",

"neck1","neck",

"head","neck1",

"lBrow","head",

"mBrow","head",

"rBrow","head",

"lMouth","head",

"mMouth","head",

"rMouth","head",

"eyelids","head",

"LLip","head"

};

};

class OFP2_ManSkeleton

{

isDiscrete = 0;

skeletonInherit = "Head";

skeletonBones[] =

{

"weapon","",

"launcher","",

"Camera","",

"Spine","",

"Spine1","",

"Spine2","",

"Spine3","",

"Pelvis","",

//Left upper side

"LeftShoulder","",

"LeftArm","",

"LeftArmRoll","",

"LeftForeArm","",

"LeftForeArmRoll","",

"LeftHand","",

"LeftHandRing","",

"LeftHandRing1","",

"LeftHandRing2","",

"LeftHandRing3","",

"LeftHandPinky1","",

"LeftHandPinky2","",

"LeftHandPinky3","",

"LeftHandMiddle1","",

"LeftHandMiddle2","",

"LeftHandMiddle3","",

"LeftHandIndex1","",

"LeftHandIndex2","",

"LeftHandIndex3","",

"LeftHandThumb1","",

"LeftHandThumb2","",

"LeftHandThumb3","",

//Right upper side

"RightShoulder","",

"RightArm","",

"RightArmRoll","",

"RightForeArm","",

"RightForeArmRoll","",

"RightHand","",

"RightHandRing","",

"RightHandRing1","",

"RightHandRing2","",

"RightHandRing3","",

"RightHandPinky1","",

"RightHandPinky2","",

"RightHandPinky3","",

"RightHandMiddle1","",

"RightHandMiddle2","",

"RightHandMiddle3","",

"RightHandIndex1","",

"RightHandIndex2","",

"RightHandIndex3","",

"RightHandThumb1","",

"RightHandThumb2","",

"RightHandThumb3","",

//Left lower side

"LeftUpLeg","",

"LeftUpLegRoll","",

"LeftLeg","",

"LeftLegRoll","",

"LeftFoot","",

"LeftToeBase","",

//Right lower side

"RightUpLeg","",

"RightUpLegRoll","",

"RightLeg","",

"RightLegRoll","",

"RightFoot","",

"RightToeBase",""

};

};

class default;

class Flag: Default {};

class FlagCarrier: Default

{

skeletonInherit = "Default";

skeletonBones[] =

{

"stozar","",

"vlajka",""

};

};

};

class CfgModels

{

class Default;

class flag_vojak : Default

{

sections[] = {"latka"};

};

class Head: Default

{

sections[] =

{

"osobnost",

"brejle"

};

skeletonName = "Head";

};

class ArmaMan : Default

{

sections[] =

{

"osobnost","Head_Injury","Body_Injury","l_leg_injury","l_arm_injury","r_arm_injury","r_leg_injury",

"clan"

};

skeletonName = "OFP2_ManSkeleton";

};

};

Step 7: Open your weapon config and add this line to it then save.

“handAnim[] = {"OFP2_ManSkeleton", "Path\to\weapon_anim.rtm"};â€

Step 8: Pack your weapon, make sure to binarize the .pbo. Enjoy. :)

th_ArmA2OA2012-09-0322-35-59-79.png

Hopefully this helps. If there is anything I missed, feel free to let me know and I'll update this post.

Edited by b00ce
  • Like 1

Share this post


Link to post
Share on other sites

Big thumbs up for this! Always good to see new tutorials being put out there :)

Funnily enough, I've made custom anims but don't remember adding the - class PulseRifle_anim : ArmaMan {}; I assume that is required and I must of added it at some point lol

Share this post


Link to post
Share on other sites

According to this guy it is required, at least that's what I gathered from him.

Share this post


Link to post
Share on other sites

I think you misread TheSun's post a little - you can literally just copy and paste the model.cfg from the BIS sample character over into whatever folder you have your .rtm saved to without any changes, and the config will use the model.cfg definition for the OFP2_ManSkeleton from that model.cfg based on the entry in the config [handAnim[] = {"OFP2_ManSkeleton", "PATH TO HANDANIM.RTM"};]. There's no need to add any additional lines to that model.cfg relating to your weapon's handanim.

What TSN is talking about when he says

creating a separate model.cfg in each weapon's folder (f.e. acr_weapons\m60e4\model.cfg) containig the desired weapons bones and animations
is the model.cfg for things like the bolt, trigger and muzzle flash animations that operate on the weapon itself. You make a separate one in these folders to stop them overwriting the model.cfg that you have where your .rtms are located (the one that contains the definition of OFP2_ManSkeleton)

Personally, I put all my .rtms inside a folder called 'anims' and have the model.cfg where OFP2_ManSkeleton is defined in there, (e.g P:\ukf_ukweps\anims\UKF_L123_trig.rtm and P:\ukf_ukweps\anims\model.cfg) and have the other model.cfg that contains all the bolt, trigger, magazine etc. anims for my weapon .p3ds in the main folder (P:\ukf_ukweps\model.cfg).

I imagine it's possible to combine all the code from the OFP2_ManSkeleton model.cfg into the one with all the weapon data as well, so you just have one model.cfg - but copy+pasting it to a sub-folder containing the .rtms seems like it'd take far less time.

Good tut though mate: As you know, I do some things a little differently - but your method is sound, and completely functional. :)

Share this post


Link to post
Share on other sites

Ah, I see. I'll amend that bit about the model.cfg in my post. :)

Share this post


Link to post
Share on other sites

Can someone please upload a archive with a working new holding rtm and config setup?

I've spent a good deal of hours dealing following this thread ( http://forums.bistudio.com/showthread.php?87052-Hand-Animations/page7 ) and Booces tutorial but I still can't get it to work.

Here's my not working setup:

http://www.mediafire.com/?dl8g6k6gwp92453

It includes a simple setup of a new weapon and rtm (p3d for the rtm included). Still getting deforms.

Share this post


Link to post
Share on other sites

what "anim steps" should be for crew animation /driver/ ?

Share this post


Link to post
Share on other sites
Is there something special with handanimations for launchers?

Not really, you just place the hands around the 'launcher' bone instead of the 'weapon' one.

what "anim steps" should be for crew animation /driver/ ?

For static ones they tend to be -0.500000 for Phase 0 (default character pose with arms spread etc), with 0.000000 and 0.100000 for Phase 1 and Phase 2 - same setup as handanims.

Moving crew anims tend to have many more keyframes, numbered between 0 and 1 depending on the point at which the keyframe is activated in the animation sequence.

Share this post


Link to post
Share on other sites

Alright, thank you - then I have made this correct.

Now I think I am lost in this point :(

I will explain my working steps, maybe someone have got a solution for me.

I followed this tutorial step by step.

This is a picture of my Handanim together with my weapon and the Launcherbone - I make sure to make the tubes at same direction.

http://i1142.photobucket.com/albums/n611/Wiz15/animsprobleme_zpseae6e46c.png

After that I delete my Weapon and make sure to hit the delete Empty in the Selection Box

http://i1142.photobucket.com/albums/n611/Wiz15/animsprobleme2_zps3fa3e1f1.png

After I have exported my rtm I make sure that I have the model.cfg in the same folder - I used the model.cfg from the released sample Characters.

http://i1142.photobucket.com/albums/n611/Wiz15/anims-probleme3_zpsc322069c.png

I start binpbo and binarize the addon and also make sure to binarize the rtm too.

And my ingame result is still a horrible gesture..

http://i1142.photobucket.com/albums/n611/Wiz15/Arma2OA2013-02-2215-58-08-29_zpsaa9227d5.jpg

What am I doing wrong?

If someone want to have a look at my rtm I can send it via pm.

Share this post


Link to post
Share on other sites
what "anim steps" should be for crew animation /driver/ ?

Im away from my computer right now, but if you check the YouTube tutorials thread, you'll see that I have a video tut in there that talks about static cargo anims, Vilas.

Abs

Share this post


Link to post
Share on other sites
Alright, thank you - then I have made this correct.

Your process seems to have all the steps needed to be honest. Having the weapon and hand bones close to certain other bones in skeleton has aparently caused problems for some people though, so maybe try moving them further way in front of the 'spine' etc. bones. Personally I don't binarize my .rtms either.

I generally try to import an animation that I know works, then modify that to make a new handanim. I have this slightly modified version of the BISkeleton that I use for making handanims myself:

Modified skeleton

It's basically just the BISkeleton with some proxies added to the 'weapon' and 'launcher' selections that you can load your weapon models onto by right-clicking the "proxy::..." selections and 'rename' to point to your weapon models.

Then if you select the proxy and click "\View\Show Proxy Objects", your weapon model will show in the O2 viewport alongside the animation skeleton; in order to help position the hands in the right place relative to the 'weapon'/'launcher' selection

The file also contains two sample .rtms based on the normal BIS rifle-raised and AT-launcher stances that you can import by right-clicking the 'keyframes' box and using "From Matrices (all LODs)". I use these anims as the basis for all my own handanims because they place the hands and weapon bones at a 'natural' distance from the rest of the skeleton from the get go. Then you just need to move the hands around your weapon to make a 'perfect' anim.

Before you Export your new .rtm, just delete the two "proxy::..." selections from the 'named selections' box.

So long as I also have the sample model.cfg in my project folder next to the .rtm, I've had a 100% success rate making handanims based on those sample stances. Been a while since I did an AT launcher though; I think the last one I did was for the BWMod's PZF3.

Edited by da12thMonkey

Share this post


Link to post
Share on other sites

Thanks again for that :)

I have tried to move my hand bones to other positions and I have also watched over your files.

Well, now I think that my problem is not the way I do my *.rtm files.

As the repositioning of my hand bones doenst work, I have taken your p3d and loaded your launcher template rtm.

I change the Handpositions and saved it the usual way and deleted your proxie selections. Now the gesture is in a other way but still freaky.

The hands are now going straight to the air and not the left side.

Well, then I thought maybe I have done something wrong again in the Finger joint curling.

I then put your Template rtm in my anims folder, rechecked my model.cfg - told binpbo to not binarize the rtm, changed the path of my Handanim to your template rtm that I havent changed now.

And again the same gesture fail - arms straight to the air.

Is there something that can occur this problems in another way?

Maybe something has to do with my model itself?

I can be sure that there is no Problem with the model.cfg because I have done some Character work and these are working great ingame with that same Model.cfg.

Really extreme strang thing - my first and only Problem I havent found a solution yet, after so many problems I had and solved them easy and quick with and without help..

Share this post


Link to post
Share on other sites

since arma2 it is the weapon type that determines many things including animation , whilst normal weapons are straigh forward handanim = _x maybe launcher is not so easy to over ride and simply because its a launcher it will use _x.

how is your config looking ?

Share this post


Link to post
Share on other sites

What is that _x?

Never heard from that.

I can define every BiS Launcher Handanimation, they work fine.

Only the rtm's that I include into my pbo won't.

I define the Handanim like every other Handanime with the line

handanim[] = {"OFP2_ManSkeleton", "\doy\Panzerfaust3\Data\Anim\pzf3_anim.rtm"};

and the one I am currently using is the Handanim for the MAAWs with the same but another path

handanim[] = {"OFP2_ManSkeleton", "\Ca\weapons_E\Data\Anim\MAAWS.rtm"};

Here is the part of the config I am using for this launcher

class doy_Pzf3_dm12: Launcher
	{
      scope = 2;
	displayName= Panzerfaust 3 Dm12;



	model = "\doy\Panzerfaust3\doy_pzf3-ungeladen";
	handanim[] = {"OFP2_ManSkeleton", "\doy\Panzerfaust3\Data\Anim\pzf3_anim.rtm"};
	picture="\doy\Panzerfaust3\data\img\doy_dm12_ui.paa";
	UiPicture="\doy\Panzerfaust3\data\img\doy_dm12_ui.paa";

	modelOptics="\doy\panzerfaust3\doy_optika_pzf3";


	opticsZoomMin = 0.15;
	opticsZoomMax = 0.15;
	distanceZoomMin = 200;
	distanceZoomMax = 200;

      muzzlePos = "PipeBegin";
	muzzleEnd = "PipeEnd";
	memoryPointCamera = "eye";
	cameraDir = "look";
	magazines[]={"doy_Pzf3_dm12"};

	sound[]={\ca\Weapons\Data\Sound\RocketLauncher_Shot04_A,db20,1}; //pokus
	drySound[]={\ca\Weapons\Data\Sound\Javelin_dry_v1,db-80,1};
	reloadMagazineSound[]={\ca\Weapons\Data\Sound\flare_reload,db-70,1};


	value = 20;
	recoil=launcherBase;
	aiRateOfFire=5.0;
	aiRateOfFireDistance=600;
	}; 

Share this post


Link to post
Share on other sites

_x is just a generic term ignore it

It seems if hands are in air your rtm is not defined and therefore it reverts to some none anim

Or your rtm is not auto timed before being saved in O2 and this broken

Or the rtm path is wrong in config

Or it's not being carried by binpbo

All should be revealed in

Arma report on local temp folder

Share this post


Link to post
Share on other sites

I recently ran into something similar. No matter what I did, all weapon animations got corrupted when used in game (other animations were fine).

The problem was, that the rtm:s were not binarized (i.e. opening the rtm:s under the BIN_TEMP hierarchy showed they where still "RTM_0101" and not "BMTR").

I had to resort to manually binarize my weapon animations as described here:

http://forums.bistudio.com/showthread.php?87052-Hand-Animations&p=1447690&viewfull=1#post1447690

Maybe it's the same for you?

Share this post


Link to post
Share on other sites

Thanks for these hints and tipps.

As I recognized that there muste be a problem with my BinPbo installation I tried the way mrflay suggestioned.

During preparing the files I have got an idea to do a test on my laptop.

I installed the needed tools for binarizing and run BinPbo on the Laptop.

Rechecked the Pbo at my Computer and well done now it works.

Now I have to check my BiTools installation and configuration, maybe there is something broken.

http://i1142.photobucket.com/albums/n611/Wiz15/Arma2OA2013-02-2717-00-47-12_zpsf0a05b5a.jpg

Share this post


Link to post
Share on other sites

Is this tutorial still valid for A3?

I'm trying to create my own animations for my rifle but it doesn't seems to work...

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  

×