Hello all,
First time noob poster ALERT! (just a heads up)
Thanx for letting me join this group.
I started play'n around with Away3d a couple of days ago, ... kinda
reached the limit of what can be done using plain action script. I got
my objects up, moving around, following a path ...the usual 'Hello
world' things to do. Very nice, very easy to get started, nice job.
Here is where I'm stuck.
I have an object, cube for now, following a path using the
pathanimator. All working.
What i would like to do is actually draw the path behind the cube, as
the cube moves along the path. I want a trail, so to speak.
And I am stuck in two ways.
1) what to use. LineSegments, Segments???
2) how to implement it. How to actually draw the path, step by step.
I have a function (below) i use to draw the complete path. All
working. But not what I want.
So I was thinking of using the pathanimator.getPositionOnPath()
function. I figured I can get the current position (vertex) of the
cube every time it is rendering the path animation.
Then get the mesh from the scene -> add a new, small segment, and so
on
But I can't get that to work, I don't think getPositionOnPath is the
right way to go.
Any suggestions, pointers ?
Thanx
byteit
private function DrawPath(trgPath:Array):void
{
var trgMesh:Mesh = new Mesh();
trgMesh.name="mesh1";
this.myGroup.addChild(trgMesh);
var segment0:Segment = new Segment();
for (var n:int = 0; n<trgPath.length;n+=9)
{
segment0.moveTo(trgPath[n],trgPath[n+1],trgPath[n+2]);
segment0.curveTo(trgPath[n+3],trgPath[n+4],trgPath[n+5],trgPath[n
+6],trgPath[n+7],trgPath[n+8]);
}
trgMesh.addSegment(segment0);
}