[Closed] Local to world coordinates
I am trying to import a skeleton stored in local coordinates but i am getting an error can someone tell me what i am doing wrong the bones don’t seem to be quite right.
resultMatrix = transMatrix [Trans_array[i].x,Trans_array[i].y,Trans_array[i].z]
resultMatrix = resultMatrix * (rotateXMatrix (radToDeg Rotation_array[i].x)) * (rotateYMatrix (radToDeg Rotation_array[i].y)) * (rotateZMatrix (radToDeg Rotation_array[i].z))
resultMatrix = resultMatrix * scaleMatrix [Scale_array[i].x,Scale_array[i].y,Scale_array[i].z]
if (Bone_Parent_array[i] != 0) do (
resultMatrix = resultMatrix * BNArr[(Bone_Parent_array[i])].objecttransform
)
newBone = bonesys.createbone \
resultMatrix.row4 \
(resultMatrix.row4 + 0.01 * (normalize resultMatrix.row1)) \
(normalize resultMatrix.row3)
newBone.name = BoneName
newBone.width = 0.03
newBone.height = 0.03
newBone.transform = resultMatrix
newBone.setBoneEnable false 0
newBone.wirecolor = yellow
newbone.showlinks = false
newBone.pos.controller = TCB_position ()
newBone.rotation.controller = TCB_rotation ()
do i need to keep multiplying till i reach the bone root how would i do that?
I guess what i need to do is get the transformation values of the bones parent till i reach the root node somehow.
like if i had a bone chain parented in order 1 2 3 4
and i want to place bone 4 i need to multiply
4 * 3 * 2 * 1
Do your self a big favor and get Bobos The Matrix Explained from http://cg-academy.net