Hi all,
I have a Vector3 instance (v3_orig) that represents a point where a line segment has passed through a plane. In the application, the plane can have arbitrary rotation values (0 < x < 180, 0 < y <180, 0 < z < 180). After determining the point where the line segment crosses the plane, I want to rotate the point from its initial intersection position to a new position so that the point would be at the same position on the plane if the plane orientation had been normalized (Quaternion.identity). I do not want to use Transforms, as the Vector3 is part of a larger mesh object, and I simply want to rotate the vertex position.
I have solutions that work if the initial plane is only rotated in two of three axes (XY, YZ, or ZX) but I can’t get it to work if all three axes have a value != 0.
Here is the original code (c#):
Vector3 v3_orig = Vector3(4,3,5) // some point that intersects with plane
Quaternion q = Quaternion.identity;
q.eulerAngles = new Vector3(-20, -20, 40); // Corrected angles to virtually rotate plane
Matrix4x4 m = Matrix4x4.TRS(Vector3.zero, q , Vector3.one);
Vector3 v3_final = m.MultiplyPoint3x4(v3_orig);
I have tried several variants on this theme and will post if anyone thinks they can give me a hand with this problem. Would also be happy to post a few images that help explain the problem if my explanation is not adequate.
Thank you.