Search code examples
scalingo3d

Need help scaling in o3d


I have been having trouble find much documentation on o3d (not too surprisingly). Does anyone know how to scale my x in o3d?


Solution

  • In the o3djs.math module there is a function:

    o3djs.math.matrix4.scaling = function(v) ...
    

    where "v" is a vector. So if you have a current transformation matrix you could do:

    var scaleMatrix = o3djs.math.matrix4.scaling( [0.6, 1, 1] );
    var newMatrix = o3djs.math.mulMatrixMatrix4(scaleMatrix, currMatrix);
    

    The "newMatrix" would scale the X dimension of the cube by 0.6 and then apply "currMatrix" after that.