1
$\begingroup$

I am a Direct2D/C++ programmer and I want to experiment the procedural 3D animation of a street based on a text file. In the text file, I would be having something like this,

Length (in meters)  Curvature(Angle)     Uphill (Angle)       Downhill(Angle)

1000                     -                   -                      20°

300                      20° (left)          -                       -

500                      5° (right)          30°                     -

This means, for 1 kilometre the street is straight with 20° downhill. The next 300 meters the street has 20° curve (no uphill and no downhill). After that for the next 500 meters the street has 5° towards right direction with 30° uphill. So, programmatically I need to generate road details (terrain).

As for beginning, the street does not have any landscape (no trees, no buildings, no traffic signs, etc.) and only one car is moving inside the lane in a variable speed. I need to see the car movement using chase cam view.

Is it possible to implement my requirement using Blender (if needed, with some add-ons)? Or, am I better off with some other tool?

$\endgroup$

2 Answers 2

2
$\begingroup$

Consider a script below in the screen image below

![https://i.sstatic.net/mnBXM.png][https://i.sstatic.net/mnBXM.png]

enter image description here

Here are some roads in spirals because rather than straight line segments. Spirals are easier to see. You can see how the script has changed the extrude and depth settings in the geometry panel. The curve is shown in edit mode to display the vertex points of the curve.

enter image description here

  • This script expects points in 3D space [x,y,z,1]. 2D space can be promoted to 3D. The script was rotting and is being recycled and needs to be cleaned up to suit you. It will serve as a starting point. Many data structures are present in the example.

  • Plot400 plots curve segments based on a start point and end point. To be compatible with the function,your data will be transformed from current state to simple segments. Perhaps that missing step in available already at nominal cost from your data provider. Your data must be transformed via standard rotation matrices (sin cos). Even though it is a curve in a general sense the segments are created in straight line segments. You will end up with a blender curve object type.

  • Because a curve exists you may exploit the Path Constraint in Blender for your car or camera to follow. The target of the Path Constraint will be the curve path created above. One can change path constraint influence as an object changes path.

$\endgroup$
2
  • $\begingroup$ Could you post a link to the script? $\endgroup$ May 25, 2015 at 14:46
  • $\begingroup$ @MajidFouladpour the image link is now clickable and thus more readable. I suggest you click and hand type the 30 lines you need. It will take me quite some hours to find the file from long ago, once I start. $\endgroup$ May 25, 2015 at 19:21
3
$\begingroup$

This is definitely possible with Blender, and not at all outside the scope of Blender (which is a scriptable animation tool) But you do have to learn the Python API since I don't think any existing addons do this.

Example of Blender generating scenes: http://cgchan.com/suicidator/

$\endgroup$
1
  • $\begingroup$ @javafan, nope, this site is for Blender only - better ask in unity forums $\endgroup$
    – ideasman42
    Oct 16, 2014 at 14:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .