move verticles along their normals

Software: Away3D 4.x

Avatar
80prozent, Sr. Member
Posted: 09 October 2011 01:14 PM   Total Posts: 430

hi

is there any function build in away3d that enables us to move all verticles of a geometry along their normals ?

another (maybe stupid) question: this far i am allways using _autoDeriveVertexTangent=true. i know what the VertexNormals are and what they are doing, but for what is the VertexTangent data used for ?

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Choons, Sr. Member
Posted: 09 October 2011 10:12 PM   Total Posts: 281   [ # 1 ]

Hi Pro - I did a small experiment with that using a cylinder recently.

// keep a copy of original models data
var refVertices:Vector.<Number>;
refVertices = SubGeometry(cylinder_1.geometry.subGeometries[0]).vertexData;

// get the normals data for your object
var vertNormals:Vector.<Number> = SubGeometry(cylinder_1.geometry.subGeometries[0]).vertexNormalData;

// make some variables
var distance:Number = 10;
var translateX:Number;
var translateY:Number;
var translateZ:Number;

// set em up
translateX = vertNormals[x] * distance;
translateY = vertNormals[y] * distance;
translateZ = vertNormals[z] * distance;
 
refVertices[x] += translateX;
refVertices[y] += translateY;
refVertices[z] += translateZ;

// update the vertices
SubGeometry(cylinder_1.geometry.subGeometries[0]).updateVertexData(refVertices);

   

Avatar
80prozent, Sr. Member
Posted: 10 October 2011 12:58 AM   Total Posts: 430   [ # 2 ]

yeah!

thanks choons!

looks exactly like it is what i was looking for.

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Choons, Sr. Member
Posted: 10 October 2011 01:29 AM   Total Posts: 281   [ # 3 ]

glad to help. your wireframe experiment is just what I was looking for too wink

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X