Hi guys,
I am currently doing the Unit 1 player control path on the Junior programmer pathway. I’ve reached an issue where my vehicle flies in the air when I switch to game mode, despite the code being exact in the video? Any help would be appreciated.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float speed = 5.0f;
public float turnSpeed;
public float horizontalInput;
public float forwardInput;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
horizontalInput = Input.GetAxis("Horizontal");
forwardInput = Input.GetAxis("Vertical");
//Moves vehicle forward
transform.Translate(Vector3.forward* Time.deltaTime* speed * forwardInput);
transform.Rotate(Vector3.up, Time.deltaTime * turnSpeed * horizontalInput);
}