i am working on a project on creating your own complex 3d models(like probuilder but like an application) but when i try to rotate my generated mesh by say 90° it actually gets rotated by 180°.
i cant seem to figure out why?
0°

90°

i want it to be rotated by 90 degree but it actually gets rotated by 180 degree
when i replace the mesh with any other predefined mesh(cube or cylinder) its works fine. so i think the problem is when i created the mesh. Edit:- i have pinpointed the problem in this code.this code modifies the mesh vertices according to the gameobject vertices so that i can deform the face when i move the vertex
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeformFace : MonoBehaviour
{
public Face face;
public List<Vertex> sharedVertices=new List<Vertex>();
Mesh mesh;
public List<Vector3> meshVertices=new List<Vector3>();
private void Start()
{
sharedVertices=face.sharedVertices;
for (int i = 0; i < sharedVertices.Count; i++)
{
meshVertices.Add(sharedVertices[i].transform.position);
}
mesh =GetComponent<MeshFilter>().mesh;
}
private void Update()
{
DeformingFace();
}
public void DeformingFace()
{
for (int i = 0; i < sharedVertices.Count; i++)
{
meshVertices[i] = sharedVertices[i].transform.position-transform.position;
}
mesh.vertices = meshVertices.ToArray();
}
}
It does that with all kind of mesh ? (triangle, square, cube, ...)
The only thing I can think of is that you're deforming the same vertices multiple times.