Skip to content

Posts tagged ‘multiplication’

Multiplying matrices in MotionBuilder?

June 1, 2012


For the life of me I can’t figure this out – If I have a null and a cube at the origin, with the cube rotated and the null placed at [0,20,0] – Setting the nulls transform by multiplying it by that of the cubes should put it into the coordinate space of the cubes. (Essentially orbiting it about the cube)

This doesn’t appear to be the case though, as it appears to be doing the transformation in-place I.e. doing the transform with the first 3 rows and then adding the position part 4th row.

from pyfbsdk import *
box = FBFindModelByName('Cube')
null = FBFindModelByName('Null')

k = FBMatrix()

j = FBMatrix()

m = FBMatrix(j * k)


Just found out the FBMatrixMult – seems to do the job.


Multiplying rotations..

February 27, 2012


Never really needed to do this, but if you try to scale a rotation as a quaternion all you do is scale it’s axis’. The only way I know of is summation:

local rot = (eulerAngles 0 45 0) as quat
local sum = quat 0 0 0 1
local scl = 2.5

 for i = 1 to floor(scl) do
sum += rot

sum += slerp (quat 0 0 0 1) rot (mod floor(scl) scl)