I know i have asked this ALOT but everytime it works i change it up , and this … will be the last time ![]()
So anyway basicly i have aim down sights script ( NOT mine ) i got it from the wiki , but if i use it then i cant play any animations OR i havr to wait till the animations are done, then it aims down sights , so when i hold up AND shift i want my sprint to play and then i want my gun to return to its original position im trying to look for a fresh script but until then i will lend you one to modify ![]()
Animation script :
if(Input.GetKey(KeyCode.W))
animation.Play("walkUMP");
if(Input.GetKey(KeyCode.S))
animation.Play("walkUMP");
if(Input.GetKey(KeyCode.A))
animation.Play("walkUMP");
if(Input.GetKey(KeyCode.D))
animation.Play("walkUMP");
else if(!Input.anyKey)
animation.Play("idleUMP");
Aim down sights script :
var nextPos = -0.1597214;
var nextField = 40.0;
var nextPos2 = -0.2532201;
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")) {
nextField = 40.0;
nextPos = -0.2202;
nextPos2 = -0.2410035;
GetComponent("CharacterController").maxForwardSpeed = 3;
GetComponent("MouseLook").sensitivityX = 2;
camera.main.GetComponent("MouseLook").sensitivityX = 2;
camera.main.GetComponent("MouseLook").sensitivityY = 2;
} else {
nextField = 60.0;
nextPos = -0.1597214;
nextPos2 = -0.2532201;
GetComponent("CharacterController").maxForwardSpeed = 6;
GetComponent("MouseLook").sensitivityX = 6;
camera.main.GetComponent("MouseLook").sensitivityX = 6;
camera.main.GetComponent("MouseLook").sensitivityY = 6;
}
}
Of course any help will be apprecitated no matter how small the info is
Thank you for your time