Question by
Remus322 · Sep 04, 2020 at 02:59 PM ·
c#cameramovementcamera-movement
How to make an object go the direction it is facing?
This is the code from Brackeys video:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerMovement : MonoBehaviour {
public CharacterController controller;
public float speed = 12f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * speed * Time.deltaTime);
}
}
Comment