i have created a head model in 3d max i want to be able to give an interface of entering the diameter of the head and making the head according to that. I am aware that I can do it with mesh morphing but can i get any sample script or any help on how i can do that.
You could download the [Procedural Examples][1] project from Unity: it creates and modifies meshes at runtime, and may help you.
EDITED: I suggested the Procedural Examples because they have scripts that deform meshes - like the script CrumpleMesh.js, for instance. In your case, maybe a mesh scaling function could do the job:
function ScaleMesh(scaleX: float, scaleY: float, scaleZ: float){
var mesh: Mesh = GetComponent(MeshFilter).mesh;
var verts: Vector3[] = mesh.vertices; // get a copy of the vertices
for (var i=0; i<vertices.Length; i++){
// scale each vertex
verts _= Vector3.Scale(verts*, Vector3(scaleX, scaleY, scaleZ));*_
}
mesh.vertices = verts; // assign the scaled vertices to mesh.vertices
mesh.RecalculateNormals(); // fix mesh normals
mesh.RecalculateBounds(); // adjust mesh bounds
}
Place this function in a script attached to some object, then call it passing the scale in each axis in scaleX, scaleY and scaleZ (1 means no change, of course). The result is the same as setting Scale in the Inspector - but changing the field Scale affects the object children as well, specially when the parent is rotated (children get skewed when the scale is non-uniform), while scaling the mesh doesn’t have any effect in the children.
_*[1]: Unity Asset Store - The Best Assets for Game Making