Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.