- Home /
Fps Controller fixed object (Gun) (Solved)
I have made a simple aiming script for my gun. I adjusted the gun and arms to where I wanted them on the FPS controller and now when I hit play they just disappear! I checked the position on AimPose and HiPose and coordinates are right where I wanted them. I made a simple aim script and this all started to happen when I changed it a little such as the position of MainCam = GameObject.FindGameObjectWithTag("MainCamera"); WeapCam = GameObject.FindGameObjectWithTag("WeaponCamera"); If it is not the code and anyone knows the solution could you please help here is my script....(JavaScript)
var HiPose : Vector3;
var AimPose : Vector3;
private var MainCam : GameObject;
private var WeapCam : GameObject;
function Start () {
transform.localPosition = HiPose;
MainCam = GameObject.FindGameObjectWithTag("MainCamera");
WeapCam = GameObject.FindGameObjectWithTag("WeaponCamera");
}
function Update () {
if(Input.GetButton("Fire2")){
transform.localPosition = AimPose;
MainCam.camera.fieldOfView = 50;
WeapCam.camera.fieldOfView = 50;
}
if(!Input.GetButton("Fire2")){
transform.localPosition = HiPose;
MainCam.camera.fieldOfView = 60;
WeapCam.camera.fieldOfView = 60;
}
}
Do you have a picture with relevant inspector settings and hierarchy.
Also consider spacing up the text in the question so people can speed read the question.
Answer by Ian-McCleary · Aug 23, 2013 at 01:43 AM
it was actually an animation that i didnt know was in place
Your answer
Follow this Question
Related Questions
aim script error 1 Answer
FPS Aim Down Sights. Exact Position. 1 Answer
Aiming Gun at Cursor 2 Answers
Help with fps script 2 Answers
How do I make an object move? 3 Answers