Sorry, but is this function broken? I was using it earlier, but for some reason, it just entirely fails at what it seems to be intended to do.
I’ve been giving a vector an angle to rotate, but for some reason it gives an entirely unreasonable result. The following code seemed to work in one direction, but when rotated past -90 or +90 (to something like -135 or + 135) on the yaw angle, it just flat out broke. Started spitting out insane results. I’d give it a 30 degree angle to rotate around, and it would rotate by a miniscule amount. It would also jump around randomly, for no apparent reason. To sum this up in code…
This code is broken. I had assumed it would work just like the second piece of code.
VectorToBeRotated:Rotate(AngleDifference)
But it doesn’t seem to?
local InitialLength = VectorToBeRotated:Length()
local InitialAngle = VectorToBeRotated:Angle()
local FinalVector = ((InitialAngle + AngleDifference):Forward()) * InitialLength
So, my question is, is this just borked? If so, is there a better way of rotating the angle than what I’m using? Or rather, since I know there is, can someone point me to the math behind it?