Weapon Animations (Vertex)

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
Elite
Posts: 8
Joined: Mon Oct 30, 2006 8:23 am
Location: Canada
Contact:

Weapon Animations (Vertex)

Post by Elite »

I am having troubles with animating my weapons... sorta. Animating is nto where I am havign problems, more or less getting these animations played.

What I want:
- Vertex animations in my weapon files to be played

What I know:
- Head animations using vertex animation within the head.md3 files work correctly.
- MD3 files support vertex animation
- My weapons seem to be only animated as static meshes using tags
- I can animate using tags within my weapons and everythign works as normal, the problem is more or less I want fingers to move via vertex animation

What I would really love someone to fill me in on if possible:
- What does the barrel anim bits, animated weap. and barrel draw bits inside the weapon.cfg files mean? I have tried setting animated weapon inside this file to 1 to get vertex animations played, but nothing makes a difference.
- Am I overlooking a feature within the code that is already implemented/partially implemeted to get vertex animations played for weapons, or am I looking at some coding? I can code, that's easy, but I don't want to replicate what's allready there, and considering vertex animations for heads work correctly I am almost positive that it would work for weapons as well.
- Example. TCE skips the handsmodel entirely and just uses the weapon view models and vertex animation to make the hands move... this is what I want as well.

I looked through the code and it "looks" as though vertex animations should be played for weapons, as all the frames are still being drawn, I just don't understand why they won't be played. Basically it appears as the model parts only play one base frame even though they have many frames, and the tags that normally drag these parts on the screen is what "animates" weapons.

Thanks in advance if anyone can give me a hand on the any above. I think my problems are more or less I am thinking in large chucks, but if anyone can give me a pointer in the direction I need to head (I don't need code/tutorials, I just would like to know where the right direction is to get these vertex animations played) I would be very thankful.

Thanks,
=>ETK<= Elite

==========
EDIT:
Sometimes when I read what I post I think I help myself a tad... possibly. ANyhow, are these animations only read in the handsmodel files only? I think earlier I was thinking it would just grab the entire model data from all weapon files supplied if it was there and just play it if it existed (basically one frame would normally be in part models and just repeat). If so, is there a way I can "toggle" the drawing of the meshes inside the handsmodel files?
The Necromancer
Posts: 126
Joined: Sat Sep 25, 2004 7:12 am
Contact:

Post by The Necromancer »

you have to use those unfilled fields in weapon animations cfg file
though main part animating does not work, and needs to allowed in game, or just don't try to animate main weapon
you can always attach barrels to tag_weapon anyway
Hi! I'm a .signature *virus*! Copy me into your ~/.signature to help me spread!
Elite
Posts: 8
Joined: Mon Oct 30, 2006 8:23 am
Location: Canada
Contact:

Post by Elite »

The Necromancer wrote:you have to use those unfilled fields in weapon animations cfg file
though main part animating does not work, and needs to allowed in game, or just don't try to animate main weapon
you can always attach barrels to tag_weapon anyway
I am using the tags to animate the weapons, and it is moving the parts properly. However, I want vertex animation for the hands as well along with the tag animation (so I can move the fingers on the hands).

What do these fields mean? What are the values I use in them more specifically, or how can I get/determine the values I need to use for these fields.

The bottom line is it can be done. Either it is allready supported or not. All I need to know if it is possible without any code modifications, or is it something I am looking at coding in. I am more or less confused because I don't know what these unfilled values in the weapon.cfg files represent or how I go about getting the values I need to enter in them, and what changes will be made to the weapon models (that do have vertex animation contained within them) during in game animations.

Thanks Necromancer, but I am still somewhat confused.
The Necromancer
Posts: 126
Joined: Sat Sep 25, 2004 7:12 am
Contact:

Post by The Necromancer »

I can code, that's easy
why don't you just have a look self?
well, if you want to animate barrel1 and barrel2 you will add their bits to barrel anim bits, in this case 3, animated weapon will just add bit for the last part (main part ), however code is preventing it's usage
draw bits will set barrels invisible
Hi! I'm a .signature *virus*! Copy me into your ~/.signature to help me spread!
Elite
Posts: 8
Joined: Mon Oct 30, 2006 8:23 am
Location: Canada
Contact:

Post by Elite »

Code: Select all

	if&#40; partid == W_MAX_PARTS &#41; &#123;
		return qtrue;	// primary weap model drawn for all frames right now
	&#125;

	// check draw bit
	if&#40; anim->moveSpeed & &#40;1<<&#40;partid+8&#41;&#41; &#41; &#123;	// hide bits are in high byte
		return qfalse;	// not drawn for current sequence
	&#125;

	// find part's start frame for this animation sequence
	// rain - & out ANIM_TOGGLEBIT or we'll go way out of bounds
	for&#40; i = 0; i < &#40;cent->pe.weap.animationNumber & ~ANIM_TOGGLEBIT&#41;; i++ &#41; &#123;
		if&#40; wi->weapAnimations&#91;i&#93;.moveSpeed & &#40;1<<partid&#41; &#41;	&#123;	// this part has animation for this sequence
			frameoffset += wi->weapAnimations&#91;i&#93;.numFrames;
		&#125;
	&#125;

	// now set the correct frame into the part
	if&#40; anim->moveSpeed & &#40;1<<partid&#41; &#41; &#123;
		part->backlerp	= parent->backlerp;
		part->oldframe	= frameoffset + &#40; parent->oldframe - anim->firstFrame&#41;;
		part->frame		= frameoffset + &#40; parent->frame - anim->firstFrame&#41;;
	&#125;
Thanks Necromancer. Now this makes much more sense.

So basically, I can either:
- Slightly adjust some of that code above and any necessary relations to ".movespeed" if they affect the drawing
- Just add a dummy main weapon file and my normal main view model will just be a barrel part
The Necromancer
Posts: 126
Joined: Sat Sep 25, 2004 7:12 am
Contact:

Post by The Necromancer »

just weld this condition

Code: Select all

   if&#40; partid == W_MAX_PARTS &#41; &#123;
      return qtrue;   // primary weap model drawn for all frames right now
   &#125; 
with the one bellow

Code: Select all

   // check draw bit
   if&#40; partid != W_MAX_PARTS && anim->moveSpeed & &#40;1<<&#40;partid+8&#41;&#41; &#41; &#123;   // hide bits are in high byte
      return qfalse;   // not drawn for current sequence
   &#125;
Hi! I'm a .signature *virus*! Copy me into your ~/.signature to help me spread!
Elite
Posts: 8
Joined: Mon Oct 30, 2006 8:23 am
Location: Canada
Contact:

Post by Elite »

Thanks Necromancer.
Post Reply