I am starting a fps game. I am currently doing the scope part of a m4a1.
I made a cam for the scope called scopecam and a javascript called scope.
here is what it is inside the script:
var Aim : boolean = false;
var Cam : GameObject;
function Update () {
if (Input.GetMouseButtonDown(1)) {
Aim = true;
if (Aim == true) {
Cam.active = true;
}
if (Input.GetMouseButtonUp(1)) {
Aim = true;
if (Aim) {
Cam.active = false;
}
}
}
}
I believe that 1 is for the right mouse, isnt it?
after that i have linked the script to the first person controller and the cam to the fp controller too.
I have also dragged the cam to the script where it says - cam: none(gameobject).
everything is ok until when i test the game, the scope is not responding.
thanks for the help!