This does the trick. It is a bit of a hack but it works. If you know
of a better/faster way to actually access the grouped Vertex please
let me know.
var o3d:MovieMesh = event.target as MovieMesh;
var vert:Vector.<Number> = o3d.vertices;
var length:int = vert.length;
var force:int = 0.003;
var vertexHash:Dictionary = new Dictionary();
var key:String;
var i:int;
for( i = 0; i < length; i +=3)
{
var v:Vertex = new Vertex(vert[i],vert[i+1], vert[i+2]);
key= vert[i]+" "+vert[i+1]+" "+vert[i+2];
if(vertexHash[key] == undefined)
{
v.x += Math.sin(force + i/3);
v.y += Math.sin(force + i/3);
v.z += Math.sin(force + i/3);
vertexHash[key] = v;
}
}
for( i = 0; i < length; i +=3)
{
key = vert[i]+" "+vert[i+1]+" "+vert[i+2];
if(vertexHash[key] != undefined)
{
var v3:Vertex = vertexHash[key] as Vertex;
vert[i] = v3.x;
vert[i+1] = v3.y;
vert[i+2] = v3.z;
}
}
On Oct 26, 8:47 pm, mogg <[email protected]> wrote:
> katopz,
>
> Your recent submission of the water demo gave me a better clue.
>
> One thing I was doing wrong was casting to Object3D when I should have
> been casting to ObjectContainer3D.
>
> Once I figured that out I was able to access the "vertices" Vector<>
> array.
>
> Unfortunately this array is not an array of Vertex but an array of all
> the points. If I move one it breaks the triangle from the object. I
> believe what I'm trying to do may not be possible on loaded models
> because of the vertices sort. I need to be able to move the same point
> for several triangles via the Vertex which was possible in Away3D
> 3.0.0. My second guess is in the new architecture for Away3Dlite I
> need to first figure out all the connecting vertices, group them, then
> move each group (model Vertex) together in order to get the effect I
> want.
>
> Again, thank you for your help.
>
> On Oct 26, 11:22 am, katopz <[email protected]> wrote:
>
>
>
> > do try see+learn from away3dlite.animators.bones.SkinVertex for that
>
> > hth
>
> > 2009/10/26 mogg <[email protected]>
>
> > > I was thinking, with the added speed, vertex manipulation could lend
> > > itself to some really cool effects.
>
> > > On Oct 26, 6:36 am, mogg <[email protected]> wrote:
> > > > If this is not possible with Away3Dlite just let me know. I can get a
> > > > similar effect with pixel bender.
>
> > > > On Oct 25, 8:33 pm, mogg <[email protected]> wrote:
>
> > > > > Here is how I use to do this in Away3D 3.0.0.
>
> > > > > //UNDERWATER EFFECT
> > > > > var mt:Mesh = loader.handle as Mesh;
> > > > > var mtA:Mesh = loaderA.handle as Mesh;
>
> > > > > for(var x:int = 0; x < mt.vertices.length; x++)
> > > > > {
> > > > > // reset
>
> > > > > mt.vertices[x].x = mtA.vertices[x].x;
> > > > > mt.vertices[x].y = mtA.vertices[x].y;
> > > > > mt.vertices[x].z = mtA.vertices[x].z;
>
> > > > > cnt++;
> > > > > mt.vertices[x].x += (Math.sin(cnt)*3);
> > > > > mt.vertices[x].y += (Math.sin(cnt)*3);
> > > > > mt.vertices[x].z += (Math.sin(cnt)*3);
>
> > > > > }
>
> > > > > Is this possible with Away3Dlite? I have dug around the geometrydata
> > > > > but seem to keep hitting brick walls. Any help would be much
> > > > > appreciated.
>
> > > > > On Oct 25, 6:07 am, mogg <[email protected]> wrote:
>
> > > > > > In Away3D I could loop through a mesh's vertices and manipulate them
> > > > > > prior to rendering each frame. In Away3Dlite I'm having trouble
> > > > > > figuring out how to do this. Any pointers?
>
> > > > > > By-the-way...Away3Dlite ROCKS!- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -
>
> > --
> > katopzhttp://www.sleepydesign.com-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -