RESOLVED: How can I show lines in the screen(away3d_4_0_110915)?

Software: Away3D 4.x

Avatar
redfox2008cn, Newbie
Posted: 19 September 2011 09:06 AM   Total Posts: 21

At the first ,LineSegment extends Segment.

scene.addChild method need ObjectContainer3D or it’s child object

so i addChild LineSegment object
then there is wrong,how can i show lines in away3d_4_0_110915??

   

Avatar
redfox2008cn, Newbie
Posted: 19 September 2011 09:22 AM   Total Posts: 21   [ # 1 ]

there is SegmentSet Class…..

   

Avatar
Alejandro Santander, Administrator
Posted: 20 September 2011 01:52 AM   Total Posts: 414   [ # 2 ]

Hey RedFox,

Sorry about that, looks like LineSegment being in the primitives package is a bit confusing. We’ll put it in a better place and try to be clearer in future releases.

To do what you want you can do something like this:

var lineSet:SegmentSet = new SegmentSet();
   for(var 
i:uint1000; ++i)
   
{
    
var start:Vector3D = new Vector3D(rand(-500500), rand(-500500), rand(-500500));
    var 
end:Vector3D = new Vector3D(rand(-500500), rand(-500500), rand(-500500));
    var 
line:LineSegment = new LineSegment(startend0xFFFFFF Math.random());
    
lineSet.addSegment(line);
   
}
   view
.scene.addChild(lineSet); 

Which results in this:
http://www.lidev.com.ar/tests/away3d/line_test/

   

Avatar
redfox2008cn, Newbie
Posted: 20 September 2011 06:50 AM   Total Posts: 21   [ # 3 ]

Thank you very much!

   

Avatar
redfox2008cn, Newbie
Posted: 20 September 2011 08:15 AM   Total Posts: 21   [ # 4 ]

hi administrator,i want to change the line which showed in view,how can i get the line from SegmentSet?

   

Avatar
Alejandro Santander, Administrator
Posted: 20 September 2011 08:00 PM   Total Posts: 414   [ # 5 ]

I’ve updated SegmentSet.as to have a new method:
public function getSegment(index:uint):Segment

This way you can retrieve a segment by index and alter it.

You will need to use the latest fp11 version in github to be able to use this.

   

Avatar
redfox2008cn, Newbie
Posted: 22 September 2011 03:49 AM   Total Posts: 21   [ # 6 ]

thank you for your reply,and sorry to trouble you so many times. i finded the way to solve the problem.
i stored the lineSegement objects in another Array,when i need to change line’s properties,i get it from line’s Array,and update it,then set it in SegementSet’s updateSegment method,it worked.

   

Avatar
Alejandro Santander, Administrator
Posted: 22 September 2011 06:51 AM   Total Posts: 414   [ # 7 ]

Sure, that works, but you can obviate your array given that SegmentSet keeps track of its line segments, and with the method getSegment(index:uint):Segment that I’ve put in, you can now retrieve them.

No difference in your results, just letting you know that you can do it that way.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X