weapon sway

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
arnir
Competition winner
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

weapon sway

Post by arnir »

hello Iam making an weapon sway animator.
Ihave already create gun sway like farcry like this: http://www.youtube.com/watch?v=yy8nhHj0JVk

its easy. it uses only two sin:

Code: Select all

float fracsin = sin(2 * Time * 0.0075);
float fracsin2 = sin( Time * 0.0075);	
	    
//update weapon offset
pos.Y += scale * fracsin * 0.05;
pos.X += scale * fracsin2 * 0.05;
it works well, but I want to make gun bobbing like this:
http://www.youtube.com/watch?v=_ronZSYof7A

or this:

http://www.youtube.com/watch?v=b3jZolXS0TA

any ideas?
programmer is bad designer
designer is bad programmer
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

I believe that this better to be done in animation of the gun, not irrlicht animator. So then, when walking, you just play the animation.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Post by ACE247 »

I say its definelty easier to do it in an animation. But then again better as in performance i would not say. Vertex positions are recalculated all the time wether animated or coded. so do as you like. :)
arnir
Competition winner
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

Post by arnir »

no, its generally solved by animator. you can see it in public SDK's that includes source code also.
rtc Wolfenstein use animator too, and it have SDK with source code too, but I can't solve the problem: how it works :?
programmer is bad designer
designer is bad programmer
Post Reply