0
\$\begingroup\$

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.

\$\endgroup\$
0
4
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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