Hey guys, haven’t posted on here in a while but i recently started doing some 3d stuff, and I was having trouble thinking about how to do recoil of a gun properly. Just so you know the gun is set up like a gun in any cod game (that viewpoint). So i was thinking maybe using a sin function to make it move slowly make and forth after shooting. Something like this old code i pulled from one of my older games
batch.draw(Assets.star, starX, (MathUtils.sinDeg(derp) * 50) + 200);
derp += 10;
if (derp > 360) {
derp = 0;
}
Then I am not sure about the up and down movement, or even left to right (maybe some similar sin function to go left and right but of a lower scale.)
Then for walking I think something similar may be in effect with sin. From what I think that would make it go up and down smoothly. Maybe I will add small screen rotation in with that I am not too sure… Any suggestions here are welcome! I did google the recoil and couldn’t find anything related to video games :-\