RESOLVED: How to get updated vertices ?

Software: Away3D 3.x

Kissa, Newbie
Posted: 29 September 2011 12:01 PM   Total Posts: 4

Hello,
I have a rotating sphere but when I read the vertices, for example this one :

sphere.vertices[5].x;
sphere.vertices[5].y;
sphere.vertices[5].z

The values x, y and z are constant even if the sphere rotate. So, how could I get updated vertices?
Thanks in advance!

   

Avatar
Alejandro Santander, Administrator
Posted: 30 September 2011 04:32 AM   Total Posts: 414   [ # 1 ]

You seem to have a conflict understanding world space and object space. Geometry vertices are layed out in object space. The geometry itself is in world space. When you apply a rotation to the object, you are altering its world space transform, which does not touch object space at all. If you want to be more familiar with this, I recommend reading material about 3D transformations.

Or you could ignore these fancy terms and see it as sprites within a sprite. The inner sprites are your vertices. If you rotate the container sprite, why would the coordinates of the inner sprites change? They don’t care that their ‘world’ is rotating… within that space coords are the same.

If you want to read the position of a vertex in world space you would have to do:
objSpaceVertexPos = vertices[n];
worldSpaceVertexPos = object.transform.transformVector( objSpaceVertexPos );

   

Kissa, Newbie
Posted: 30 September 2011 07:37 AM   Total Posts: 4   [ # 2 ]

Thank you so much for these deep informations! You’re right about local/global coordinates and the analogy with sprites and their container.
Now I understood how to do and all works perfectly smile

   

Avatar
Alejandro Santander, Administrator
Posted: 30 September 2011 12:50 PM   Total Posts: 414   [ # 3 ]

Glad it does! I’ll close this topic then.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X