Getting the vector between a part's upVector and lookVector

Hi! I am trying to figure out the formula for calculating a new vector between a part’s upVector and lookVector. The angle between this vector and the other two vectors will of course be 45 degrees, but how would I do this?

You can think of this as just creating a right triangle where the base and side are the two orientation vectors, and then the hypotenuse is the resultant vector. Since you want the vector that’s exactly in between them (i.e. 45 degrees from each) and because they’re orthogonal, it’s quite easy. In fact, it’s also made easier by the fact they’re both unit vectors! Ultimately, to get the unit vector that is 45 degrees off of each of them, you just need to do this:

local part = ...
local newVector = (part.CFrame.UpVector + part.CFrame.LookVector).Unit
2 Likes

Thanks a ton! :slight_smile: :slight_smile: