Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to move object with keyboard in unity 3D

public class realguymoves : MonoBehaviour //the class of object
{
    //movement
    float speed;

    float horizontal;
    float vertical;
    Vector3 moveDirecion;
    float drag;



    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        horizontal = Input.GetAxisRaw("Horizontal"); //getting the horizontal axis of the object
        vertical = Input.GetAxisRaw("Vertical"); //getting the vectical axis of the object

        moveDirecion = transform.forward * vertical + transform.right * horizontal;
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to open website from c# program 
Csharp :: get out of foreach statement c# 
Csharp :: Minimize window to system tray c# 
Csharp :: asp.net core get root url in view 
Csharp :: c# add string to array 
Csharp :: c# int array length 
Csharp :: c# list length 
Csharp :: How to take input on float in c# 
Csharp :: check if internet is connected with c# winforms 
Csharp :: operator -- c# 
Csharp :: c# add to array 
Csharp :: getmousebuttondown unity 
Csharp :: route attribute controller with parameter asp.net core 
Csharp :: weapon switching unity 
Csharp :: roman to 
Csharp :: how to set a transform equal to something unity 
Csharp :: Replaced OS is obselete 
Csharp :: c# execute shell command 
Csharp :: rigidbody velocity c# unity 
Csharp :: C# monogodb 
Csharp :: unity 3d movement script 
Csharp :: split string c# 
Csharp :: how to get total scenes unity 
Csharp :: minimize maximize restore wpf buttons 
Csharp :: get array from column datatable c# 
Csharp :: c# is odd number 
Csharp :: c# template 
Csharp :: unity reference textmeshpro 
Csharp :: check if value in list c# 
Csharp :: csharp get decimal part of number 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =