Updating Vertex Data

Software: Away3D 4.x

Mothra, Newbie
Posted: 02 February 2013 09:06 AM   Total Posts: 3

Hi,

So I’m creating a mesh on the fly by creating a bunch of vertices.  Its a tail that is following a ball.  Usually it appears just fine, but every now and then, when I would create a new tail, it just wouldn’t be visible at all.

I’ve tried using MeshHelper.Build as well as subGeometry.updateVertexData, and both were giving the same results.  I’ve now figured out that if I use the MeshHelper.Build and turn off ‘sharedVertices’ I never have this problem.  Making the tail much wider also fixes the problem (but isn’t a solution).

Any idea why its happening?  Maybe away3d auto-welds vertices that are close together?  Intuitively, subGeometry.updateVertexData seems like it would be a much faster solution (though I don’t know that for sure), but I can’t seem to make it work, and don’t know if I can turn off ‘sharedVertices’ for that?

Thanks,
Rob

   

Lexcuk, Newbie
Posted: 02 February 2013 04:28 PM   Total Posts: 17   [ # 1 ]

Then I create a mesh I’m set for it boundsSubGeometry and it’s work very well.
Set the bounds side as bigger as you can, and i hopes it can be visible of any time.

boundsSubGeometry = new SubGeometry();
   
geometry.subGeometries.push(boundsSubGeometry);
   
//http://swf-flash.blogspot.com/2012/04/away3d-40-how-i-made-tire-marks-with.html
  
}

  
public function setBoundSize(minBound:Vector3DmaxBound:Vector3D):void {
   
   
var xMin:Number minBound.x;
   var 
xMax:Number maxBound.x;
   
   var 
yMin:Number minBound.y;
   var 
yMax:Number maxBound.y;
   
   var 
zMin:Number minBound.z;
   var 
zMax:Number maxBound.z;
   
   var 
boundsVertexData:Vector.<Number> = Vector.<Number>(
   xMin
yMinzMin,
   
xMinyMaxzMax,
   
xMaxyMinzMin,
   
xMaxyMaxzMax
   ]
);
   
   var 
boundsIndexArr:Vector.<uint> = Vector.<uint>([
   0
00,
   
111,
   
222,
   
333,
   
]);
   
   var 
boundsUVData:Vector.<Number> = Vector.<Number>([
   0
11100,
   
011100,
   
011100,
   
011100,
   
]);
   
   
boundsSubGeometry.updateVertexData(boundsVertexData);
   
boundsSubGeometry.updateUVData(boundsUVData);
   
boundsSubGeometry.updateIndexData(boundsIndexArr);
   
//geometry.invalidateBounds(boundsSubGeometry);
  

For example

lex3Strip.setBoundSize(new Vector3D( -1000, -1000, -1000), new Vector3D(100010001000)); 
   

Mothra, Newbie
Posted: 03 February 2013 06:52 AM   Total Posts: 3   [ # 2 ]

Worked great!  Thanks a lot!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X