Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the procedure to convert 2d path to 3d one. Maybe it's a silly question, but for example:

Let's assume that I have a path from point A to point B. And I have all X and Y coordinates of that path. Is it possible to convert that to a 3d path, so for example to animate a car driving along that path but in 3D.

share|improve this question

Converting a path from 2D to 3D can be fairly easy, you just have to assume that your car is on a flat plane. Then for each point on the 2D path (x, y), you create a point in 3D (x, y, z) where the third component is 0.

According to your 3D engine, the nul component will be y or z, but the idea is the same.

share|improve this answer

Your car is driving on some map, I presume, so use your X and Y to sample Z at this point of the map via ray intersection with map mesh triangles. Just google "ray intersections" for hundreds of examples. Then add some offset reflecting car's height to it, and you're done.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.