I hava a plane, which I know the normal(normal0), and 2 points(pointA, pointB).
Now I have another normal:normal1.
I need to rotate plane from normal0 to normal1 around pointA, How can I know the new position pointB after rotation?
The func would be like:
Vector3 changeNormal(Vector3 normal0, Vector3 normal2, Vector3 pointA, Vector3 pointB)
{
…
return newPointB
}
This function should just do the trick:
Vector3 changeNormal(Vector3 normal0, Vector3 normal2, Vector3 pointA, Vector3 pointB) {
Quaternion rotation = Quaternion.FromToRotation(normal0, normal2); //Get rotation between both normals
Vector3 rotationDir = pointB - pointA; // Get point direction relative to pivot
rotationDir = rotation * rotationDir; // Rotate it
pointB = rotationDir + pointA; // Calculate rotated point
return pointB;
}