Vertex.<...>

Return to Introduction  Previous page  Next page

Allows manipulation of a single vertex in a mesh.

 

Properties

 

pos

A Vector describing the x,y,z position of the vertex.

normal

A Vector describing the x,y,z direction of the normal to the surface at this vertex.

texture

A Vector describing the texture coordinates at this vertex.

 

Methods

 

normalize()

Scales the normal of the vertex to be of unit length.

 

Example

 

function onClick()

{

       var verts=object.subgroups.Box.vertexGetArray(); // get all the vertices in the Box subgroup

       verts[15].pos.x+=10; // move a vertex +10 along the X axis

       object.subgroups.Box.vertexSetArray(verts); // save changes

 

       var faces=object.subgroups.Box.faceGetArray(); // get all the faces in the Box subgroup

       faces[0].materialIndex=1-faces[0].materialIndex; // swap material index of face between 1 and 0

       object.subgroups.Box.faceSetArray(faces); // save changes

}

 

Remarks

 

Changes to the mesh are not written until the vertexSetArray function is called.

 

See Also

 

System



Copyright ©2004 Worldweaver Ltd. DX Studio Home