Making a river, varying width along path

Oceax

09-09-2013 21:21:28

I'm trying to create a river where the width of the river should be different for each point along the path.
How could i achive this? Multishape? :?

Oceax

09-09-2013 22:41:09

Ok now i found the scale track thing, can't get to scale the way i want it.

For each point in path i also add a certain scale "point" to my "scale spline" that i then convert to scale track.
The rivers scales now, but i looks like i get the same scale everywhere. :/


scaleSpline.setNumSeg(2);
spline.setNumSeg(2);
for (int i = 0; i < worldRiver.segmentList.size(); i++)
{
int addPoint = i % 4;

if (addPoint == 0)
{
spline.addPoint(worldRiver.segmentList.start.x, pSurfaceManager->getHeightAt(worldRiver.segmentList.start.x, worldRiver.segmentList.start.y), worldRiver.segmentList.start.y);
scaleSpline.addPoint(worldRiver.segmentListWidth,1);
}
}

scaleTrack = scaleSpline.realizeShape().convertToTrack(Procedural::Track::AM_POINT);
Procedural::Extruder().setExtrusionPath(&path).setShapeToExtrude(&shape).setScaleTrack(&scaleTrack).setUTile(0.01f).setVTile(0.01f).realizeMesh("extrudedMesh");

mikachu

27-09-2013 23:23:29

That's because when you define
scaleSpline.addPoint(worldRiver.segmentListWidth,1);
the first parameter must correspond to the point of the path where you want to define scale ("i"), and the second is the scale (worldRiver.segmentListWidth).

From the documentation:
AM_POINT : the key represents the index of a point in the main curve.