Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

simple player controller unity

//USES A RIGIDBODY (Unity)//

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
   public float speed;
   
   private Rigidbody rb;
   
   
   
   //Start is called before the first frame update//
   void Start()
   {
       rb = GetComponent<Rigidbody>();
   }
   
   //Update is called once per frame
   void FixedUpdate()
   {
      float moveLR = Input.GetAxis("Horizontal");
      float moveFB = Input.GetAxis("Vertical");
      
      rb.AddForce (new Vector3(speed * moveLR, 0, speed * moveFB));
   }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# list with 0 initialize 
Csharp :: add dependency injection .net core console app 
Csharp :: C# Unit test IConfiguration 
Csharp :: mvc get base url 
Csharp :: c# read authorization header 
Csharp :: unity key up 
Csharp :: switch case c# contains 
Csharp :: https request c# 
Csharp :: how to install jdk on linux manjaro 
Csharp :: o(n*m) 
Csharp :: hash table in c# 
Csharp :: list.max c# 
Csharp :: c# print list 
Csharp :: make http request c# 
Csharp :: how to reference a UI element in unity 
Csharp :: unity actions 
Csharp :: how to check datagridview cell is null or empty 
Csharp :: what is type unity 
Csharp :: unity 3d camera movement script 
Csharp :: debug.log 
Csharp :: dotnet call webapi 
Csharp :: unity audio 
Csharp :: what is botnet attack 
Csharp :: how to create empty text file in c# 
Csharp :: get file extension in c# file upload 
Csharp :: get user startup folder path C# 
Csharp :: c# foreach object in array json 
Csharp :: getter setter c# 
Csharp :: c# dictionary with multiple values 
Csharp :: sort file name with C# 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =