Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Need help with Unity Racing Game

Discussion in 'Getting Started' started by Jamin257, Oct 17, 2023.

  1. Jamin257

    Jamin257

    Joined:
    May 4, 2023
    Posts:
    2
    Hello everyone,

    I am currently in the process of building a racing game. I have the Player's car movement down to a basic version and I am now trying to figure out how to create opponents for the players to compete with.

    The most common solution to this via google searching and tutorial videos is ray casting and determining how far the car is from the edge of the track so that it doesn't turn the wrong way, however, that in itself is quite complex and I am struggling to understand it.

    Has anyone got any tips or am I doing the wrong thing to create opponents?

    Thanks
     
  2. Reaktion

    Reaktion

    Joined:
    Nov 8, 2019
    Posts:
    53
    Hi,

    Seems to me that you should take a look at Navigation System : Unity - Manual: Navigation System in Unity (unity3d.com)
    It should allow you to set up areas
    NavMesh
    where your opponents
    NavMesh Agent
    will move towards a destination.
    (NOTE : I've never used it, so I'm just sharing my thoughts here)
     
  3. Jamin257

    Jamin257

    Joined:
    May 4, 2023
    Posts:
    2
    Thank you so much for the help.

    I had a look at the Navigation system as recommended and it looks perfect for what I need. It seems you can create areas for navigation which allow the AI opponents to go down the correct routes, take short cuts and avoid each other/obstacles at the same time.

    Thanks again for the help!
     
    Reaktion likes this.