- Home /
How can I deform a rectangle to involve a pillar?
I am trying to make a rectangle with 18 divisions involve another rectangle.
A picture from the rectangle: 
My best result: 
The code:
edit: I have improve the code, but it doesn't work well yet.
 int i = 0;
 int triangleCount = 0;
 for (int k = 0; k < vertices.Length; k++)
     {
         if (i == 2) // two triangles
         {
             i = 0;
             triangleCount++;
         }
         float newX = R * Mathf.Cos(degree * triangleCount * Mathf.Deg2Rad);
         float newZ = R * Mathf.Sin(degree * triangleCount * Mathf.Deg2Rad);
         Vector3 vertex = vertices[k];
         vertex.x += (origin.x - vertex.x) + newX;
         vertex.z += (origin.z - vertex.z) + newZ;
         vertices[k] = vertex;
        Vector3 normal = normals[k];
        normal.x += (origin.x - vertex.x) + newX;
        normal.z += (origin.z - vertex.z) + newZ;
         normals[k] = normal;
         i++;
     }
Is there any way to do this?
 
                 
                rect.png 
                (40.7 kB) 
               
 
                
                 
                result.png 
                (30.4 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How to return mesh of interactive cloth? 0 Answers
Disabling Mesh renderer on collision 1 Answer
Bend 3d object (Mesh) at Runtime 2 Answers
In Game Mesh Deform With Bone 0 Answers
Breaking down Unity's Procedural Example "sculpt vertices" 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                