Wednesday, August 27, 2008

as3 geom as class mirror property

Here's a small bit of code I pasted into an as3 geom class to ave the option of inverting the mesh either x,y or z. the uvs work fine

replace function 'v' with:

but first create a mirror var:

public var mirror :String;

private function v(x:Number,y:Number,z:Number):void
{
switch (mirror){
case "x":
verts.push(new Vertex3D(-x,y,z));
break;

case "y":
verts.push(new Vertex3D(x,-y,z));
break;

case "z":
verts.push(new Vertex3D(x,y,-z));
break;

default:
verts.push(new Vertex3D(x,y,z));
break;
}
}


pass the var into the constructor
when you initiate your object
either "x","y","z"

public function coccyx( material:MaterialObject3D=null,mirror:String="", initObject:Object=null )
{
//--\\
//---\\
//---//
this.mirror = mirror


even better would be code for a combination of all three

download th as3 geom class exporter here

No comments: