Gun Recoil

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
DarkRage4
Posts: 31
Joined: Wed Jul 29, 2009 11:07 pm
Location: Ontario, Canada
Contact:

Gun Recoil

Post by DarkRage4 »

I got the very basics of my game going and I'm moving along quite nicely...now I would like to see if I could get the gun and the arm holding the gun to move while holding down the left mouse as to make a realistic shooting affect. Could some1 post a source code for it...I know I would use event receiver to tell when the left mouse button is being pulled down but how would I make it so the arm and gun shake?
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

animation?
like you make 3 animation for hands, and for gun: normal (doing almost nothing), running (moving a bit), shooting (shaking)
Image
Image
DarkRage4
Posts: 31
Joined: Wed Jul 29, 2009 11:07 pm
Location: Ontario, Canada
Contact:

Post by DarkRage4 »

you can do it without animation. I made the gun shake when you move but im having trob using event receiver with the same code, so I need a sep code to make the gun shake upon clicking the left mouse button
ReturnZero
Posts: 4
Joined: Fri Jul 03, 2009 7:05 pm

Post by ReturnZero »

You can rotate the camera on its X axis prior to the user pressing the left mouse button
DarkRage4
Posts: 31
Joined: Wed Jul 29, 2009 11:07 pm
Location: Ontario, Canada
Contact:

Post by DarkRage4 »

ya I think I'll try that I just need it to return to the normal position repeatedly
ReturnZero
Posts: 4
Joined: Fri Jul 03, 2009 7:05 pm

Post by ReturnZero »

DarkRage4 wrote:ya I think I'll try that I just need it to return to the normal position repeatedly


You many need some sort of event receiver to check whether the mouse button is held or not.

When it is first pressed, record it's position, then when it is released, make it go back to the original position.
Post Reply