Leroy1981

07-20-2017, 08:06 AM

I've been trying to find the best way to calculate the rotation that would align vector A with vector B. I have found solutions but in my case I need the relative up direction to be preserved. Therefore I have been trying to accomplish this with just 2 rotations. First on the Y axis to align the vectors relative to Y, then I calculate the angle between them at this point which would give me the X rotation. However, handling these components of rotation separately doesn't produce the desired effect when I apply both rotations. Applying the Y rotation to the vector turns it perfectly to line up with vector B. But when I apply X rotation, it doesn't rotate properly. I know this is most likely because the X rotation is being applied along the regular X axis and not the vector's current x axis. Any suggestions would be awesome. It's really frustrating me