Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Rotate Object/Camera by Mouse

    Vector3 currentCameraEulers;
    float rotationDPI = 7f; 

    void Update()
    {
        float cameraX = Input.GetAxisRaw("Mouse X") * rotationDPI;
        if (cameraX != 0f)
        {
            currentCameraEulers = new Vector3(0, cameraX, 0);
            transform.eulerAngles += currentCameraEulers;
        }
        float cameraY = Input.GetAxisRaw("Mouse Y") * rotationDPI;
        if (cameraY != 0f)
        {
            currentCameraEulers = new Vector3(cameraY, 0, 0);
            transform.eulerAngles += currentCameraEulers;
        }
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: push vaiable in array c# 
Csharp :: get innermost exception c# 
Csharp :: record keyword c# 
Csharp :: c# variables 
Csharp :: jtoken value is not exact 
Csharp :: asp.net disabled checkbox style 
Csharp :: array hw exercise 
Csharp :: how do make internet 
Csharp :: c# dictionary key set 
Csharp :: xamarin forms uwp button hover 
Csharp :: Using a Views in .net and c# 
Csharp :: unity shader blend 
Csharp :: ########## 
Csharp :: .net core not returning the sub list 
Csharp :: C# pull appart property chain in expression 
Csharp :: CS0176 
Csharp :: notification platform not available c# 
Csharp :: C# Custom setter with parameter 
Csharp :: temp^late php table for mysql 
Csharp :: unity rotatetowards 
Csharp :: firepower 4125 License update 
Csharp :: c# return error status code based on exception 
Csharp :: number to string ef example c# 
Csharp :: leantween unity when timescale 0 
Csharp :: c# ulong 
Csharp :: c# boolean 
Csharp :: auto refresh gridview c# 
Csharp :: imagetarget found event vuforia c# 
Csharp :: how to oppen a site using c# 
Csharp :: downloading a large file asp boilerplate (abp) 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =