- Home /
Race Interfaces
I have this racing game and to control distances, race completion and positions I've created interfaces, like invisible checkpoints.
The next step is to create teh AI for the non-player racers.
The racer is calculating his own distance to the next interface using Vector3.Distance(Transform origin, Transform destination);
But the Using Gizmos.DrawRay (or DrawLine) shows me that the distance is being calculated on a point I don't know. I wish I could use the center of mass of the interfaces (stretched cube meshes without colliders) or directly to it in the same Y position (ray to the front?).
On the screenshot below, you can see the ray being cast to a place outside the interface itself.
You can see tue next yellow interface and the white ray being cast to a place on the left, outside the track and the interface itself.
How can I calculate the distance to the interface directly in front of me or, even if I'am facing back, still calculate the distance to it.
The racer has that interface as a variable on his script.
After that, i must criate points inside each interface to use as a raceline. What should I use? Cubes? Stretched cubes to the top just like the interfaces? Single points?
Just to register, the players are floating 10 meters from the floor on a jetpack.
Your answer
Follow this Question
Related Questions
Strange AI 2 Answers
Help with my Flocking Algorithm 0 Answers
waypointprogresstracker and runtime leaderboard 1 Answer
Help With Simple Waypoint System 0 Answers
Car drives sideways, doesn't turn 1 Answer