As stated on the wikia: CFrame | Documentation - Roblox Creator Hub ;
"Returns a tuple of a Vector3 and a number which represent the rotation of the CFrame in the axis-angle representation
My question is wouldn’t there be infinite solutions to an arbitrary vector and theta? How then are they picked with the Roblox built in? Should I make my own method because it’s faster and I’d know what’s going on?
The Wikipedia page on the operation lacks context. And the subsequent Rodrigues' rotation formula - Wikipedia is beyond my mathematical capabilities and my hunch tells me it’s not worth learning. There is no introductory materials on the concept concerning Roblox.
From the look it you have your CF, with a dot product theta to the tuple Vector3, which is thus returned. But I am uncertain.
Any help appreciated.
Thanks.
Assuming CFrame:ToAxisAngle
is the inverse of CFrame.FromAxisAngle
,
CFrame:ToAxisAngle
should return the CFrame’s UpVector(?) along with the angle it’s rotated around that vector axis. I’m not positive if it’s the UpVector, RightVector, or LookVector, but it should be one of those. You’d have to run a couple of command bar commands to figure out exactly which one it is.
Sorry for the vague answer, the wiki is not very specific on which axis it actually is. I hope this points you in the right direction.
Well it’s not the LookVector as I’ve figured out, it’s the UpVector. What a great extrapolation.
The alien technology in concerning I’ve been trying to understand:
> local function twistAngle(cf, direction)
> local axis, theta = cf:ToAxisAngle()
> local w, v = math.cos(theta/2), math.sin(theta/2)*axis
> local proj = v:Dot(direction)*direction
> local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w)
> local nAxis, nTheta = twist:ToAxisAngle()
> return math.sign(v:Dot(direction))*nTheta
> end
1 Like
Hi, this is really late, but did you ever got to understand what the math of the axis is? I was able to figure out the math behind theta, but I can’t seem to get axis. Thanks!