How to pose vertices.

Well I want my mesh - plane should swim over water surface as paper. For that i would like modify position of mesh vertices, but my script doesn’t work (

function Start(){
	thisMatrix = transform.localToWorldMatrix;
	
	mesh= GetComponent(MeshFilter).mesh;
    vertices = mesh.vertices;

}

function Update(){
    	
        for (var i = 0; i < vertices.Length; i++){
    
    		Mypos = thisMatrix.MultiplyPoint3x4(vertices*);*
  •  Mypos.y+=20;*
    
  •  if (Physics.Raycast (Mypos, -Vector3.up,hit, 30)) {*
    
  •  	print(hit.point);*
    

_ vertices = hit.point;_
* }*
* mesh.vertices = vertices;*
* mesh.RecalculateBounds();*
* }*

}

Found solution:

I needed transform.worldToLocalMatrix to transform

world coordinates to local mesh coordinates. this whole script:

var mesh : Mesh;
var vertices : Vector3[];
var Mypos:Vector3;
var Mypos1:Vector3;
var hit : RaycastHit;
var thisMatrix: Matrix4x4;
var meshMatrix:Matrix4x4;


function Start(){
	thisMatrix = transform.localToWorldMatrix;
	meshMatrix = transform.worldToLocalMatrix;
	
	mesh= GetComponent(MeshFilter).mesh;
    vertices = mesh.vertices;

}

function Update(){
	

    for (var i = 0; i < vertices.Length; i++){

		Mypos = thisMatrix.MultiplyPoint3x4(vertices*);*
  •  Mypos.y+=100;*
    
  •  if (Physics.Raycast (Mypos, -Vector3.up,hit, 120)) {*
    
  •  Mypos = meshMatrix.MultiplyPoint3x4(hit.point;);*
    

_ vertices = Mypos;_
* }*

* }*
* mesh.vertices = vertices;*
* mesh.RecalculateBounds();*
}