I’m attempting to convert Roblox CFrame (Matrix) to Blender’s matrix, the purpose of this is to enable camera animation exporting and importing said camera animation into blender, the ultimate goal here is to make motion tracking easier as we will have the camera movement data.
Roblox’s CFrame Matrix looks like this.
Note that the Y axis is up in Roblox, versus Z pointing up as in certain other engines.
Some example Lua Code
local CF = CFrame.new(
5,5,5, -- Position
1,0,0, -- RightVector
0,1,0, -- UpVector
0,0,1 -- LookVector
)
print(CF:GetComponents())
--> 5 5 5 1 0 0 0 1 0 0 0 1
ref: https://devforum.roblox.com/t/help-with-cframegetcomponents-function/343952
I found some code online that exports blenders animation as Roblox CFrames, however I had no luck making it work for importing CFrame Data into Blender.
def matrixToCFrameComponents(mat):
# switch z and y pos cause blender uses z-up coordinate system
cframe_components = [
mat[0][3], mat[2][3], -mat[1][3],
mat[0][0], mat[0][2], -mat[0][2],
mat[2][0], mat[2][2], -mat[2][1],
-mat[1][0], -mat[1][2], mat[1][1]
]
return cframe_components
Ref: https://github.com/zoebasil/blender-cf-exporter/blob/master/addon.py
This is what a CFrame looks like.
(-19.93419,14.09163,-19.06459,-0.69117,0.31943,-0.64827,-0.00000,0.89701,0.44200,0.72269,0.30550,-0.61999)
tl;dr I want to import a camera animation from Roblox into Blender and animate the camera using Roblox’s CFrame Matrix.