Hello,
I’m trying to build a flat racing track (in one plane) using PathExtrude. Here’s what I’m doing:
var data:Array = [95, 2, 134, 308.00551727857004, 2, 90.50203120837622, 521.0110345571401, 2,47.00406241675244, 521.0110345571401, 2, 47.00406241675244, 570, 2, 37, 600.5401727145911, 2,76.5891127781736, 600.5401727145911, 2, 76.5891127781736, 624, 2, 107, 647.4598272854089, 2,137.41088722182639, 647.4598272854089, 2, 137.41088722182639, 678, 2, 177, 716.8870420980152, 2,145.5707467974946, 716.8870420980152, 2, 145.5707467974946, 787.5, 2, 88.5, 858.1129579019848, 2,31.429253202505407, 858.1129579019848, 2, 31.429253202505407, 897, 2, 0, 935.2743135395408, 2,32.17261138106329, 935.2743135395408, 2, 32.17261138106329, 966, 2, 58, 996.7256864604592, 2,83.82738861893671, 996.7256864604592, 2, 83.82738861893671, 1035, 2, 116, 1083.3463220677033, 2,128.7527699942367, 1083.3463220677033, 2, 128.7527699942367, 1289, 2, 183, 1494.6536779322967, 2,237.2472300057633, 1494.6536779322967, 2, 237.2472300057633, 1543, 2, 250, 1569.499947000159, 2,292.3999152002544, 1569.499947000159, 2, 292.3999152002544, 1580.5, 2, 310, 1591.500052999841, 2,327.6000847997456, 1591.500052999841, 2, 327.6000847997456, 1618, 2, 370, 1611.4695959003936, 2,419.5717038470118, 1611.4695959003936, 2, 419.5717038470118, 1607, 2, 453.5, 1602.5304040996064, 2,487.4282961529882, 1602.5304040996064, 2, 487.4282961529882, 1596, 2, 537, 1546.058666100209, 2,539.4213980072626, 1546.058666100209, 2, 539.4213980072626, 1431, 2, 545, 1315.941333899791, 2,550.5786019927374, 1315.941333899791, 2, 550.5786019927374, 1266, 2, 553, 1216.8616300794467, 2,543.7576733691749, 1216.8616300794467, 2, 543.7576733691749, 1106.5, 2, 523, 996.1383699205534, 2,502.24232663082506, 996.1383699205534, 2, 502.24232663082506, 947, 2, 493, 908.6016815865963, 2,460.9754915256633, 908.6016815865963, 2, 460.9754915256633, 823.5, 2, 390, 738.3983184134037, 2,319.0245084743367, 738.3983184134037, 2, 319.0245084743367, 700, 2, 287, 650.6447261126208, 2,295.0035579276831, 650.6447261126208, 2, 295.0035579276831, 626, 2, 299, 601.3552738873792, 2,302.9964420723169, 601.3552738873792, 2, 302.9964420723169, 552, 2, 311, 540.0076335263032, 2,359.5405309649632, 540.0076335263032, 2, 359.5405309649632, 531, 2, 396, 521.9923664736968, 2,432.4594690350368, 521.9923664736968, 2, 432.4594690350368, 510, 2, 481, 460.6453479936827, 2,489.00739191842905, 460.6453479936827, 2, 489.00739191842905, 340.5, 2, 508.5, 220.35465200631728, 2,527.9926080815709, 220.35465200631728, 2, 527.9926080815709, 171, 2, 536, 133.58828102700346, 2,502.82827584394306, 133.58828102700346, 2, 502.82827584394306, 96, 2, 469.5, 58.41171897299654, 2,436.17172415605694, 58.41171897299654, 2, 436.17172415605694, 21, 2, 403, 21.738835580125716, 2,353.00545907815996, 21.738835580125716, 2, 353.00545907815996, 22.651429989581462, 2, 291.25323737165445, 23.56402439903721, 2,229.50101566514897, 23.56402439903721, 2, 229.50101566514897, 24, 2, 200, 23.5, 2,170.5, 23.5, 2, 170.5, 23.25, 2, 155.75, 23, 2,141]; ];
var pathData:Vector.<Vector3D> = new Vector.<Vector3D>();
for(var i:uint = 0;i<data.length;i+=3)
pathData.push(new Vector3D( data[ i]* 15 , 8, data[i+2] * 15));
var _path:QuadraticPath = new QuadraticPath(pathData);
var profile:Vector.<Vector3D> = new Vector.<Vector3D>();
profile.push(new Vector3D(-620,0,0));
profile.push(new Vector3D(620,0,0));
var _pathExtrude:PathExtrude = new PathExtrude( AsfaltMaterial , _path, profile,32 ,false, true, true, false,true,false, false);
_pathExtrude.distribute=true;
_pathExtrude.distributeU = true;
scene.addChild(_pathExtrude);
It works fine for curves (angles) > 90 but for smaller ones the textures of the segments overlap and I get something like in the attached image.
What am I doing wrong? I’ve tried playing around with PathExtrude’s params but can’t figure it out.
I would appreciate any advice Away3D related or math/quadratic path/ Bézier curve related.
Thanks.