xyz Thanks. I took out any input and rotation logic that could have interfered with the alignment code, and I'm still getting issues. I have some debug logs that show the before and after my alignment code is applied once the raycast hits the mesh geometry:
initial basis: [X: (-0.0, 0.0, 1.0), Y: (0.0, 1.0, 0.0), Z: (-1.0, 0.0, -0.0)]
initial transform: [X: (-0.0, 0.0, 1.0), Y: (0.0, 1.0, 0.0), Z: (-1.0, 0.0, -0.0), O: (223.101, 6.545028, 88.8496)]
initial rotation: (0.0, -90.0, 0.0)
triangle normal: (0.994036, 0.106564, 0.023145)
current ship basis: [X: (-0.0, 0.0, 1.0), Y: (0.0, 1.0, 0.0), Z: (-1.0, 0.0, -0.0)]
new basis: [X: (0.0, 0.21224, -0.977217), Y: (0.994036, 0.106564, 0.023145), Z: (0.109049, -0.97139, -0.210975)]
adjusted basis: [X: (0.0, 0.21224, -0.977217), Y: (0.994036, 0.106564, 0.023145), Z: (0.109049, -0.97139, -0.210975)]
adjusted transform: [X: (0.0, 0.21224, -0.977217), Y: (0.994036, 0.106564, 0.023145), Z: (0.109049, -0.97139, -0.210975), O: (223.101, 6.545028, 88.8496)]
adjusted rotation: (76.26151, 152.6664, 63.33912)
Would there be any reason why the rotation suddenly jumps from -90 deg to this new random angle? It seems like the basis alignment is working correctly unless I'm mistaken.