can a vertex move?

Software: Away3D 4.x

Avatar
venom, Newbie
Posted: 07 November 2011 05:54 PM   Total Posts: 26

hi people, i wonder if i can move a vertex, edge or plane in a 3d model with away3d 4.0? not all of the model, just one vertex? but i need this model to be one, i mean i don’t want to breake apart the model into the objects. i can move multiple of objects but what i need is one or two vertex to move in just a 3dmodel, with away3d of course, not as an animation in 3dsmax of course

thanks for your helps already smile

   

Avatar
theMightyAtom, Sr. Member
Posted: 07 November 2011 06:59 PM   Total Posts: 669   [ # 1 ]

Yes u can!
http://videometry.net/broomstick/WaveModifier.html

You need to get hold of the objects vertices, alter them, and reassign.

Good Luck!

 

   

Avatar
venom, Newbie
Posted: 07 November 2011 07:12 PM   Total Posts: 26   [ # 2 ]

thanks for the fast reply theMightyAtom smile i will look at what you told and try.

 

   

Avatar
venom, Newbie
Posted: 07 November 2011 11:10 PM   Total Posts: 26   [ # 3 ]

theMightyAtom, i’m sorry to bother but, i couldn’t manage to solve it :(

http://www.videometry.net/broomstick/ManipulateVertices.as i have examined this source code and i think this is not what i want. i mean what should i do to find the specific, the exact vertex in a complex model?

var v:Vector.<Number> = SubGeometry( _mesh. geometry. subGeometries[0]). vertexData; what that code do is to get the all of the vertexes, right?

won’t “for loop” be hard to find the vertex? what i thought is just an idea, suppose that i have a very small but a complex face model, and i want to move two vertexes to make it look like happy or sad or maybe couldn’t i name the vertexes and then use them in away3d?

 

   

Avatar
80prozent, Sr. Member
Posted: 07 November 2011 11:28 PM   Total Posts: 430   [ # 4 ]

hi

that would be a pointselection you talk about. (in cinema4d its called that)
away3d does not support this right now. (as far as i know)
the points (verticles) are stored in this vertexData-Vector.
for each point 3 values (x,y,z) are stored.
if you want to move point nr 100 5 units in every direction you would have to do:

vertexData[100*3]+=5;
vertexData[(100*3)+1]+=5;
vertexData[(100*3)+2]+=5;

than you would have to reload your vertexData.

updateVertexData(vertextData)

because you always have to upload all vertexdata to the gpu, its not to much difference in speed if you change one point or more.

 

 

 

 Signature 

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

   

Avatar
venom, Newbie
Posted: 08 November 2011 01:31 PM   Total Posts: 26   [ # 5 ]

80prozent thanks for your reply, as theMightyAtom mentioned i learnd this way to move vertexes but even in a simple cube we have 8 vertexes, if you think this is a face model, there are thousands of vertexes, how could i know that i have the rigth vertex, as i mentioned before, how can i find the two vertexes of the egde of lips so i can make my model look like sad or happy? i’m stuck in here, to find the exact vertexes? will i just try to find? or there is a simple way to find it?

 

   

Avatar
80prozent, Sr. Member
Posted: 08 November 2011 07:36 PM   Total Posts: 430   [ # 6 ]

hi
there is no easy way to get a specific verticle in away3d right now.

you could modifiy the MouseEvent3d to give you the neartest verticle on y mesh when you click on it, but i tryed and the verticle is only correct for ca.90% of the tests. the other 10 % of the tests the function gave me back a verticle near the verticle it should….

you can open your mesh in a 3d-application, select the point you want and write down its x,y,z coordinates. when you know the x,y,z coordinates of the point, you can loop through the verticles like this:

for (var i:int;i<vertexData.length;i+=3){
    
if ((vertexData[i]==myX)&&(vertexData[i+1]==myY)&&(vertexData[i+2]==myZ){
//do something to the point
}} 

 

 

 Signature 

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

   

Avatar
venom, Newbie
Posted: 09 November 2011 11:01 AM   Total Posts: 26   [ # 7 ]

hi 80prozent, thanks for your help. i see that i have to wait for a while for this idea or i will just try to find the vertexes manually as you told, it may be usefull to give a chance.

thanks again 80prozent and theMightyAtom, i will inform you if something good happens smile

 

   

Avatar
venom, Newbie
Posted: 11 November 2011 09:11 PM   Total Posts: 26   [ # 8 ]

hi people i guess i managed it but with one problem smile with your help of course 80prozent and theMightyAtom

here what i did:

public function deneme1():void{
 
var v1:Vector.<Number> = SubGeometry(headModel.geometry.subGeometries[0]).vertexData;
   
//0*i = x
   //1*i = y
   //2*i = z
 
v1[4]=v1[4]+0.2;
 
SubGeometry(headModel.geometry.subGeometries[0].updateVertexData(v1));

i use this function in EnterFrame event. in this function a vertex move in y direction. when i checked out to see the lenght of the v1 vector; i saw that i had 3times more of my vertexes. i mean if i have 4 vertexes; the length of the vector is 12.  this v1 vector keeps all of the datas in x,y,z order. in my max project i know what order these vertexes have. but it’s not in the same order in away3d project. it’s in a different order i don’t know why, i thought it’s the exporter that makes me trouble. this could not be a away3d parser error, i mean the parser gets what order the model have. by the way i use OBJ file and AssetEvent in my project. in max project i use gw::OBJExporter which comes as defoult exporter in 3dsmax. and here it is the AssentEvent function:

private function onAssetComplete(event:AssetEvent):void
{
 
if (event.asset.assetType == AssetType.MESH{
  headModel 
event.asset as Mesh;
  
headModel.geometry.scale(100);
  
headModel.= -50;
  
headModel.rotationY 180;
  
headModel.material headMaterial;
  
scene.addChild(headModel);
  
yukledi=true;
 
}

 

   

Avatar
Fabrice Closier, Administrator
Posted: 11 November 2011 09:44 PM   Total Posts: 1265   [ # 9 ]

If you export without triangulating your faces from max, the parser may need to “explode” a quad face definition from the obj data back to 2 faces, which logically adds 3 extra entries in vertices (the x,yand z value of the 4th vertex) and 3 indices extra into the indices vector for the new face reference.
if you need to count faces, do not reffer to vertices but indices. Indices length/3 = face count. As we handle only triangles, it’s always a multiple of 3.

The order is the same as defined in the obj file when it comes to vertices. However, the face indices are expressed as “b-a-c” while obj face is set as “a- b-c”. Otherwize face would appear inverted and uvs mirrored on u axis.

 

   

Avatar
venom, Newbie
Posted: 11 November 2011 11:03 PM   Total Posts: 26   [ # 10 ]

thanks Fabrice for your reply, i don’t know how to triangulate but when i change my export settings the vertexes are olso changed. in my code like i wrote before i want a vertex to go in y direction. and yet it goes but wrong one goes smile in this very simple model i have 7 vertexes and in my vector i have 21 data ( 0 - 20 ). and i wrote: vectorData[1]=100; so this code will make my first vertex to move 100 in y direction, right? and it moves but it’s not the same as 3ds max’s vertex order. let me show you my problem, it will be easier. left one is away3d’s vertex order, right one is 3dsmax’s. like i said i think it’s about my export settings. i’m gonna change settings and see what will happen…

 

   

Avatar
Fabrice Closier, Administrator
Posted: 12 November 2011 08:45 PM   Total Posts: 1265   [ # 11 ]

If internally max runs some routine that rearrange the vertices at some point in your project during build up or export… you hang.
Instead of picking the order as a reference, I would consider to use quad- or octrees instead.

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X