using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Threading;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float WalkSpeed;
//Private Variables
Rigidbody rb;
Vector3 moveDirection;
// Start is called before the first frame update
void Awake()
{
rb = GetComponent();
}
void FixedUpdate()
{
//Physics steps
}
void Update()
{
//Get directional input from the user
float horizontalMovement = Input.GetAxisRaw("Horizontal");
float verticalMovement = Input.GetAxisRaw("Vertical");
moveDirection = (horizontalMovement = transform.right + verticalMovement + Transform.forward).normalized;
void FixedUpdate()
{
//Call the Move funtion
move();
}
void Move()
{
//Here we define the Move funtion
}
void Move()
{
//Rigidbody.Velocity is a method which takes a Vector3
//and controls the speed and direction of the GameeObject
rb.Velocity = moveDirection * WalkSpeed * Time.deltaTime;
}
}
}
↧