Advertisement
Guest User

Obracanie.cs

a guest
Aug 21st, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5.  
  6. public class Obracanie : NetworkBehaviour {
  7.  
  8.  
  9.  
  10.     public int MouseSens;
  11.     public Transform Hands;
  12.    
  13.    
  14.  
  15.  
  16.     // Use this for initialization
  17.     void Start () {
  18.  
  19.      
  20.     }
  21.    
  22.     // Update is called once per frame
  23.     void Update () {
  24.  
  25.        
  26.  
  27.         Turning();  
  28.        
  29.     }
  30.  
  31.    
  32.     void Turning()
  33.     {
  34.         if (isLocalPlayer)
  35.         {
  36.             float xRotate = Input.GetAxis("Mouse X") * MouseSens;
  37.             float yRotate = Input.GetAxis("Mouse Y") * MouseSens;
  38.  
  39.             Hands.eulerAngles += new Vector3(0f, xRotate , yRotate);
  40.         }
  41.     }
  42.  
  43.    
  44.    
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement