Question by
Remus322 · Sep 04, 2020 at 02:57 PM ·
c#cameramovementcamera-movementmovement script
How to make an object go the direction it is facing? (Im new)
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