Best way to animation models?

Discuss programming in the QuakeC language.
Post Reply
Posts: 96
Joined: Thu Dec 15, 2011 1:00 pm

Best way to animation models?

Post by Max_Salivan »

1)Quake style
__state [framenumber, functiontothink];
is very messy if you have many animation,you need to spend a lot of time to do this
2)Hexen 2 style
__state [++ firstframe .. lastframe];
idk how its works,but it seems better then quake style
3)by nexttink and think

Code: Select all

	if(self.weaponframe == 15)
		self.state = NONE;
	self.weaponframe += 1;
	self.think = Draw;
	self.nextthink = time + 0.1;
looks better,but when you use think function,its can kill another think(player animation for example)
4)maybe best(or not?) way,i found on this forum

Code: Select all

void() player_reload1 = [$reload1, player_reload2] {self.weaponframe = 10;};  //Replace 10 with your start frame.
void() player_reload2 = [$reload2, player_reload3] {self.weaponframe = (self.weaponframe + 1);};  //This advances the frame count by 1.
void() player_reload3 = 
      if(self.weaponframe == 17)  //If the animation has reached its end....
            self.weaponframe = 0;  //Set the frame back to the idle frame.
            return;  //Exit this function.
      else  //If the animation still has some frames left to play...
            player_reload2();  //Continue the animation..
            return;  //Exit this function.
maybe there is another option?(not the animation group,because you cant attach sound on frame,its works in iqm)
Sorry for my english :)
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Best way to animation models?

Post by Dr. Shadowborg »

Control weaponframe animation via PlayerPostThink or better, W_WeaponFrame (in weapons.qc).

Use an animation state control system, and make some functions to more easily set / cancel animations as needed.

That way, you can avoid interrupting player animations.
Post Reply