Cannot update Vertex Data

Software: Away3D 4.x

johnnyMichigan, Newbie
Posted: 27 March 2013 06:18 PM   Total Posts: 8

Hi all, I don’t understand why I cannot update vertex data of a mesh with this code:

var originalVertexData:Vector.<Number> = myMesh.geometry.subGeometries[0].vertexData;
var 
newVertexData:Vector.<Number>;
for(var 
i:Number=0i<originalVertexData.lengthi++){
    newVertexData
.push(originalVertexData[i] += 0.5);
   
}
myMesh
.geometry.subGeometries[0].updateVertexData(newVertexData); 

This code throws an exception “Call to a possibly undefined method updateVertexData through a reference with static type away3d.core.base:ISubGeometry

Any idea?

   

Lexcuk, Newbie
Posted: 28 March 2013 07:58 AM   Total Posts: 17   [ # 1 ]

May be

(myMesh.geometry.subGeometries[0] as SubGeometry).updateVertexData(newVertexData); 
   

johnnyMichigan, Newbie
Posted: 28 March 2013 07:36 PM   Total Posts: 8   [ # 2 ]

Thanks a lot, Lexcuk! With few adjustments your code works:

var subGeo:CompactSubGeometry=(myMesh.geometry.subGeometries[0] as  CompactSubGeometry);
subGeo.updateData(newVertexData); 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X