Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 3]
Member [Lv. 3]
Posts : 17
Points : 1509
Rep : -1
Join date : 2014-06-27
View user profile

Aiming script: Where is it positioned?

on Sat Jul 26, 2014 12:20 am
I tried all of the positions, and it doesnt seem to fit just where I want. When I put it to the left and click play, it works, the aiming and everything is perfect, its just that my gun is originally positioned to the right side. If I position it to the right side, when I click play, it goes to the default place but when I right click it zooms in, doesnt make it look like its aiming at all. Can you help me?
Member [Lv. 3]
Member [Lv. 3]
Posts : 17
Points : 1509
Rep : -1
Join date : 2014-06-27
View user profile

Re: Aiming script: Where is it positioned?

on Sat Jul 26, 2014 12:23 am
By the way, I did edit the javascript and copy and paste the coordinates
Member [Lv. 3]
Member [Lv. 3]
Posts : 17
Points : 1509
Rep : -1
Join date : 2014-06-27
View user profile

Re: Aiming script: Where is it positioned?

on Sat Jul 26, 2014 12:51 am
But other than literally moving the gun it just zooms in... nothing else. Zooms in.
Member [Lv. 3]
Member [Lv. 3]
Posts : 17
Points : 1509
Rep : -1
Join date : 2014-06-27
View user profile

Re: Aiming script: Where is it positioned?

on Sun Jul 27, 2014 6:33 am
Please help, Ive been waiting for a day Sad
Member [Lv. 3]
Member [Lv. 3]
Posts : 17
Points : 1509
Rep : -1
Join date : 2014-06-27
View user profile

Re: Aiming script: Where is it positioned?

on Sun Jul 27, 2014 7:11 am
Message reputation : 0% (1 vote)
Never mind, I have figured it out. If you are having the same problem, go to your aimdownsights script, and enter this:

Code:
var gun : Transform;
 var nextPos = EDIT THIS;
 var nextField = 40.0;
 var nextPos2 = EDIT THIS;
 var dampVelocity = 0.4;
 var dampVelocity2 = 0.4;
 var dampVelocity3 = 0.4;
 
 function Update () {
    var newPos = Mathf.SmoothDamp(gun.transform.localPosition.x, nextPos, dampVelocity, .3);
    var newField = Mathf.SmoothDamp(Camera.main.fieldOfView, nextField, dampVelocity2, .3);
    var newPos2 = Mathf.SmoothDamp(gun.transform.localPosition.y, nextPos2, dampVelocity3, .3);
   
    gun.transform.localPosition.x = newPos;
    gun.transform.localPosition.y = newPos2;
    Camera.main.fieldOfView = newField;
   
    if (Input.GetButton("Fire2")) {
        //adjust viewpoint and gun position
        nextField = 40.0;
        nextPos = -0.5241224;
        nextPos2 = -0.349839;
       
        //slow down turning and movement speed
        GetComponent("MouseLook").sensitivityX = 2;
        camera.main.GetComponent("MouseLook").sensitivityX = 2;
        camera.main.GetComponent("MouseLook").sensitivityY = 2;
    } else {
        //adjust viewpoint and gun position
        nextField = 60.0;
        nextPos = -0.2393376;
        nextPos2 = -0.3882463;
       
        //speed up turning and movement speed
        GetComponent("MouseLook").sensitivityX = 6;
        camera.main.GetComponent("MouseLook").sensitivityX = 6;
        camera.main.GetComponent("MouseLook").sensitivityY = 6;
    }
 }

Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 906
Rep : 0
Join date : 2016-02-05
View user profile

Re: Aiming script: Where is it positioned?

on Fri Feb 05, 2016 3:20 am
can someone plz help
when i put the script in it is always having problems, i cant figure out how to fix it, can anyone help Cool
Back to top
Permissions in this forum:
You cannot reply to topics in this forum