UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionAiming script: Where is it positioned? EmptyAiming script: Where is it positioned?

more_horiz
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?

descriptionAiming script: Where is it positioned? EmptyRe: Aiming script: Where is it positioned?

more_horiz
By the way, I did edit the javascript and copy and paste the coordinates

descriptionAiming script: Where is it positioned? EmptyRe: Aiming script: Where is it positioned?

more_horiz
But other than literally moving the gun it just zooms in... nothing else. Zooms in.

descriptionAiming script: Where is it positioned? EmptyRe: Aiming script: Where is it positioned?

more_horiz
Please help, Ive been waiting for a day Sad

descriptionAiming script: Where is it positioned? EmptyRe: Aiming script: Where is it positioned?

more_horiz
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;
    }
 }


descriptionAiming script: Where is it positioned? EmptyRe: Aiming script: Where is it positioned?

more_horiz
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

descriptionAiming script: Where is it positioned? EmptyRe: Aiming script: Where is it positioned?

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply