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

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Aiming script: Where is it positioned?

Aiming script: Where is it positioned?

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Aiming script: Where is it positioned? on Fri Jul 25, 2014 12:20 pm

FainterStreaker


Member [Lv. 3]
Member [Lv. 3]
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?

View user profile

2 Re: Aiming script: Where is it positioned? on Fri Jul 25, 2014 12:23 pm

FainterStreaker


Member [Lv. 3]
Member [Lv. 3]
By the way, I did edit the javascript and copy and paste the coordinates

View user profile

3 Re: Aiming script: Where is it positioned? on Fri Jul 25, 2014 12:51 pm

FainterStreaker


Member [Lv. 3]
Member [Lv. 3]
But other than literally moving the gun it just zooms in... nothing else. Zooms in.

View user profile

4 Re: Aiming script: Where is it positioned? on Sat Jul 26, 2014 6:33 pm

FainterStreaker


Member [Lv. 3]
Member [Lv. 3]
Please help, Ive been waiting for a day Sad

View user profile

5 Re: Aiming script: Where is it positioned? on Sat Jul 26, 2014 7:11 pm

FainterStreaker


Member [Lv. 3]
Member [Lv. 3]
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;
    }
 }

View user profile

6 Re: Aiming script: Where is it positioned? on Thu Feb 04, 2016 3:20 pm

imaster1121


Member [Lv. 0]
Member [Lv. 0]
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

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum