- Home /
 
help with target in my fps game ?
Hello guys, i was wondering if you could help me basically i want to create a target in the mouse move script this is because i have a model and it has arms and etc but they are joined with bones and what i was thinking is if i added a var in the cam script allowing me to attach just the arms it would allow me to move the arms up and down following the camera. now i don't know how to do this i was wondering if someone could help me please thanks you in advance Mchalo :)
using UnityEngine; using System.Collections;
 
               [AddComponentMenu("Camera-Control/Mouse Look")] public class MouseLook : MonoBehaviour {
 
                public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
 public RotationAxes axes = RotationAxes.MouseXAndY;
 public float sensitivityX = 15F;
 public float sensitivityY = 15F;
 public float minimumX = -360F;
 public float maximumX = 360F;
 public float minimumY = -60F;
 public float maximumY = 60F;
 float rotationY = 0F;
 void Update ()
 {
     if (axes == RotationAxes.MouseXAndY)
     {
         float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;
         rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
         rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
         transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
     }
     else if (axes == RotationAxes.MouseX)
     {
         transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
     }
     else
     {
         rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
         rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
         transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
     }
 }
 void Start ()
 {
     // Make the rigid body not change rotation
     if (rigidbody)
         rigidbody.freezeRotation = true;
 }
 
               } 
 
               
               thanks in advance :)
Your answer
 
             Follow this Question
Related Questions
Problem with click-to-move script 0 Answers
Move Camera According to Mouse Movement While Button is Pressed 1 Answer
How to select one prefab from more ? 0 Answers
Having a first person player look at the mouse on the y axis 1 Answer
Problem with Alt + Middle Click Drag for Camera (Windows) 3 Answers