|
Hi I was wondering if anyone had an idea on how to make a gun less accurate depending on how many bursts or how long the user holds down their button. What I'd like to do is have each gun have a variable with Accuracy, then based on that the longer that they hold the "trigger" the lower the accuracy goes thus making the aim of the gun jump or spray slightly. I'm also wondering if anyone has any idea on how to, instead of bullets have what appear to be "bullet tracers" when shooting, so it looks like streaks of color projecting towards the enemy.
(comments are locked)
|
|
I've actually been working on a re-useable weapon system for FPS', so I'll post what I've been using for weapon accuracy:
} Basically all you would have to do is change the direction of your shot raycast from
to
And add to the value of "shotSpread" every time you fire a bullet and return it to normal when you stop. As far as implementing muzzle climb (making the gun slowly aim higher as you fire), all that you would need to do would be to modify the standard "MouseLook" script a little.
Basically "offsetY" rotates the camera upwards, so if you add to "offsetY" whenever you fire a bullet the gun will aim higher as you fire. Just get a hold of the camera (mainCam in my script) and add to the variable
P.S. I'm sorry if this is too much but it's exciting to see a question that is exactly what I'm working on. great answer! this helped me alot
May 20 '10 at 12:19 AM
Andrew Sander
Thanks for sharing! Will be very helpful.
Jun 14 '10 at 08:45 PM
Tuti
(comments are locked)
|
|
I have a question about the accuracy code. I got it to make my gun shoot less accurate, but once I change the vector3 how do I reset it back to aim good again?
(comments are locked)
|
|
Thank you very much!! That's exactly what I need!
(comments are locked)
|
|
Wow that's great, didn't expect such a detailed answer. I'm going to try this out and let you know. Thanks again! this is not exactly an answer to the above question. Don't post non-answers as answers... add comment instead.
Mar 12 '10 at 08:40 PM
Lipis
Well I've been working on this exact stuff for a package I want to release within a week or so (for making weapons in an FPS), so I had all this stuff ready anyway.
Mar 12 '10 at 09:09 PM
Jason_DB
(comments are locked)
|
