- Home /
Get the rotation vector from 2 vectors
Hello, I'm trying to rotate a "Matrix". I have a 3x3 Matrix like shown on the image below.
Unity has no 3x3 Matrices so I tried solving it with Vectors.
If I have the starting Vector (-1/ -1) and the end Vector (-1 / 1) is there a way to get the rotation vector? (like an inverse Matrix) (I will have to solve this problem in 3 dimensions so to just get the angle between 2 vectors isn't a solution)
Thanks in advance :)
Answer by andrew-lukasik · Jul 21, 2020 at 11:07 PM
Unity has no 3x3 Matrices
using Unity.Mathematics;
var a = new float3x3();
var b = new float3x3();
var c = math.mul( a , b );
var d = math.inverse(c);
wow, all this time I didn't know this existed. Thanks a lot man. Do you know if there is also a way to have a 3 dimensional matrix like 3x3x3?
I've never seen 3x3x3. BUT. You can create this structure yourself - if you know the math behind well enough.
public struct float3x3x3
{
public float3x3 c0;
public float3x3 c1;
public float3x3 c2;
}
boom, DONE ; )