i have a plane that i want to rotate to face a certain direction, but not using transform.rotation but by rotating the vertices. i already have the code for rotating mesh vertices arround a center :
var path = GetPath();
var angle = Quaternion.FromToRotation(mf.mesh.normals[0], path[0].rotation.eulerAngles);
var center = mf.mesh.bounds.center;
for (int i = 0; i < mf.mesh.vertices.Length; i++)
{
mf.mesh.vertices _= RotateVertex(center, mf.mesh.vertices*, angle);*_
}
public Vector3 RotateVertex(Vector3 center, Vector3 vert, Quaternion angle)
{
// rotates the vertex
vert = angle * (vert - center) + center;
return vert;
}
i only need to find a way to calculate the rotation of the mesh based on the direction and the mesh normals like this :
[186883-screenshot-2021-09-29-221051.png|186883]_
_