Creating a custom face/shape

Software: Away3D 4.x

Cheesygecko, Newbie
Posted: 05 March 2012 04:23 PM   Total Posts: 2

Hi,

I’m a newbie and tried the PathExtruder. I have made a pipe and want to close the ends so that you can’t see inside. I didn’t found code for that and now i want to create a face at start and end. I filled a face with vertex data and want to apply it ti a mesh. But the AddFace-Method
is not available in Version 4. Does someone have experience with that?
Thank you grin .

Here is an example code:

var profile:Vector.<Vector3D> = new Vector.<Vector3D>();

// profile of pipe
profile.push(new Vector3D(0,0,0));
profile.push(new Vector3D(50,0,0));
profile.push(new Vector3D(50, 50, 0));
profile.push(new Vector3D(0, 50, 0));

//create pipe
//....

// Now create start and end
var shape:Face = new Face();
var i:Number;
 
var mesh:Mesh; 
 
for (i = 0; i < profile.length; i++)
{
shape.setVertexAt(i, profile.x, profile.y, profile.z);
}

mesh = new Mesh(area, m_DefaultMaterial);

// not available in version 4
//mesh.AddFace

   

riffraff, Newbie
Posted: 06 March 2012 11:37 AM   Total Posts: 9   [ # 1 ]

Hi,
Quite simply you may directly modify geometry of mesh:

var sub_geom:SubGeometry = mesh.geometry.subGeometries[ 0 ];
sub_geom.updateVertexData( vertices );
sub_geom.updateIndexData( indices );

where:

var vertices:Vector.<Number> = new Vector.<Number>( 3 * total_vertices );
var indices : Vector.<uint> = new Vector.<uint>( 3 * total_faces ) );

Greetings

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X