Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PlayerHeadControl : MonoBehaviour
- {
- private Animator anim;
- private float x;
- private float y;
- public float SpeedRotation;
- // Use this for initialization
- void Start ()
- {
- anim = GetComponent<Animator> ();
- }
- // Update is called once per frame
- void Update ()
- {
- x += Input.GetAxis ("Mouse X") * SpeedRotation * 0.05f;
- x = Mathf.Clamp (x,-35,35);
- y += Input.GetAxis ("Mouse Y") * SpeedRotation * 0.05f;
- y = Mathf.Clamp (y,-20,20);
- anim.SetFloat ("HeadX", -x);
- anim.SetFloat ("HeadY", y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement