Line segments appear only in certain angles

Software: Away3D 4.x

doomdrake, Newbie
Posted: 11 April 2012 01:17 PM   Total Posts: 14

  I’m trying to draw a simple shape using the LineSegment and SegmentSet classes ( like you would do with a normal sprite ). All is going well, except the fact that the segments are only visible while looking from a certain direction / angle. Tried to apply a double sided material to the SegmentSet and asign a light to it ( didn’t seem to need it, but wth…) but that didn’t change anything.

  Ultimately i went ahead and used LinearExtrude, but since the lines i’m aiming at don’t need to be thick and the camera uses a very large zoom out value, the resulting mesh looks like a dashed line from that distance ( didn’t have that problem with the LineSegment).

  If any of you have any idea of how i can make those line segments viewable from any angle, it would be a huge help smile

  Below is some line segment code ( in case i’m doing something wrong ).

var pathVertices:Vector.<Vector3D> = new Vector.<Vector3D>;
var 
v:Vector3D;
var 
ls:SegmentSet = new SegmentSet();
for (var 
angle:Number 0angle <= 360angle += 1)
{
 v 
= new Vector3D(radiusX Math.cos(angle Math.PI 180), 0radiusZ Math.sin(angle Math.PI 180));
pathVertices.push(v);
if(
pathVertices.length 2)
 
ls.addSegment(new LineSegment(pathVertices[pathVertices.length 2]pathVertices[pathVertices.length 1]0xffffff0xffffff));
}
scene
.addChild(ls); 

camera lens / far values are [0.1, 100000] and i’m also using a hover controller for it

Well hope someone can help me with my noobishness smile

   

doomdrake, Newbie
Posted: 12 April 2012 07:54 AM   Total Posts: 14   [ # 1 ]

Any help would be appreciated…it’s clearly a clipping / frustrum thing but i can’t figure how to avoid it.

   

doomdrake, Newbie
Posted: 12 April 2012 10:30 AM   Total Posts: 14   [ # 2 ]

Fixed thanks to the few posts relating to the SegmentSet bounding box ( now i’m ashamed of my poor search capabilities ).

Even if this is a repost ( to some extent ) i’ll copy / paste the solution.

override protected function updateBounds() : void {
 
// todo: fix bounds
 
_bounds.fromExtremes(-100, -10001001000);
 
_boundsInvalid false;

Also fixed the if > 2 conditions that made my trajectory have a gap ( stupid mistake ) :D

  Change the 100 value to something else and you’re good to go ( i’ve even went so far as to declare a “limits” vector in the SegmentSet class so i can asign bounds according to object “move space” ).

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X