Player movement - My first game ever

Hey guys:)
I’m trying to make my first mobile game, but I’m pretty much stuck.
So, as you guys can see in the video, I posted of my game, the ball (Ball is the player) can only turn left and forward when I click on space button. How can I get the ball to turn the way that the road is turning? You know, the 3D object that the ball is driving on…

Hope you guys understand what I mean, feel free to ask:)

Here’s the video showing the game, and script:

Here’s my script:

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

public class PlayerController : MonoBehaviour {

public float speed;

private Vector3 dir;

// Use this for initialization
void Start ()
{
dir = Vector3.zero;
}

// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.Space))
{
if (dir == Vector3.forward)
{
dir = Vector3.left;
}
else
{
dir = Vector3.forward;
}
}

float amoutToMove = speed * Time.deltaTime;

transform.Translate(dir * amoutToMove);
}
}

One way I’ve seen this done in the past is to put a trigger at each turn, which will notify the player of which way to turn when space is pressed. That method can also be used for jumping and other path actions.

Thanks, I’m trying it:)

Okay, so

Okay so, I’ve added a component called “Event Trigger”, but there’s a lot of options to choose, do you know which one, I should choose?

3227446--247601--Screen Shot 2017-09-20 at 20.55.58.png

I was referring actually to a physics collider trigger:

In order for the trigger to detect your ball, the ball will need a rigidbody and a collider. Since you’re not using the physics engine to move your ball, you can set the rigidbody to kinematic.