Hello, i have a shoot script here that i need help with, what i am trying to do is add a part in the script to where when i press the “Fire1” button itll play an animation while it fires in the upperbody since the lower body is being processed with the locomotion. Can anyone help me with that?
var bullet : Transform;
var Crosshairtex : Texture;
var target : Transform;
function Update () {
if (SimpleFPSWalker.toggleCombatMode){
if(Input.GetButtonDown("Fire1")){
var hit: RaycastHit;
if (Physics.Raycast(target.position,target.forward, hit)) {
var hitpoint = hit.point;
transform.LookAt(hitpoint);
var bullet1 = Instantiate(bullet, transform.position, Quaternion.identity);
bullet1.transform.rotation = transform.rotation;
bullet1.rigidbody.AddForce(transform.forward * 1000);
}
}
}
}
function OnGUI(){
GUI.matrix = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3
(Screen.width / 1024.0, Screen.height / 768.0, 1));
GUI.DrawTexture (Rect (500,372,24,24), Crosshairtex);
}