Notifications
Clear all

[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?

6 Replies

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

I figured it out i just had my multiplication wrong.

 PEN

Do your self a big favor and get Bobos The Matrix Explained from http://cg-academy.net

 PEN

Good indication of just how good it is.

 PEN

There should be down loadable versions, are you not interested in that?