Many other posts i’ve found regarding recoil tend to speak about the kind of recoil seen in games like CoD or Counter-Strike. In my project i would like basic recoil that’ll reset smoothly after a certain period of time, being more similar to the recoil of the 357 magnum in Half-Life. I would like the camera to rotate vertically by a certain ammount and then reset. This then really turns it into more visual feedback than recoil but eh…
Of course i have tried this, but i am a fairly inexperienced programmer and my various attempts break the script.
I am working with JS and with 4 variables:
var mainCamera : Transform ;
var kickAmmount : float = -1 ;
var kickTime : float = 0.1 ; // Time taken for camera to rotate after a shot
var kickResetTime : float = 0.2 ; // Time taken for cameras rotation to reset after a shot
I would appreciate any help. Thanks!