Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PlayerCameraControl : MonoBehaviour
- {
- public float x;
- public float y;
- public float SpeedRotation;
- public Transform Player;
- void Update ()
- {
- x += Input.GetAxis ("Mouse X") * SpeedRotation * Time.deltaTime;
- y += Input.GetAxis ("Mouse Y") * SpeedRotation * Time.deltaTime;
- y = Mathf.Clamp (y, -90, 90);
- Quaternion CameraTarget = Quaternion.Euler (-y, 335, 0);
- Quaternion CharacterTarget = Quaternion.Euler (0, x, 0);
- transform.localRotation = CameraTarget;
- Player.localRotation = CharacterTarget;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement