- Home /
Question by
xXTURDLEXx · Dec 16, 2012 at 05:07 AM ·
javascriptgunshootrecoil
How do I modify my script to give my gun recoil when I shoot?
you could make me a new script or modify the shoot script here if you want. Here is my script:
var projectile : Rigidbody;
var speed = 20;
var cloneSpeed = 10;
function Update () {
if ( Input.GetButtonDown ("Fire1")) {
clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection( Vector3 (1, 1, speed));
Destroy (clone.gameObject, 5);
}}
Comment
sorry if this sounded rude but i'm not trying to be! :)
Best Answer
Answer by Fattie · Dec 16, 2012 at 08:18 AM
Hi, just search on here for "Recoil"
there are very many full and complete scripts that do it all for you. Eg
http://answers.unity3d.com/questions/318979/camera-recoilplease-help-me.html
pls "Tick" any helpful answer to quickly close out this question, thanks. You don't sound in the slightest rude :)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Shooting Projectiles 1 Answer
My gun won't fire. ( Javascript ) 1 Answer
machine gun js timing 1 Answer