0

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

Simon Nickerson
  • 42,159
  • 20
  • 102
  • 127
Mike2012
  • 7,629
  • 15
  • 84
  • 135
  • Could you be slightly more specific? – Simon Nickerson Aug 21 '09 at 21:41
  • I have a large positionArray that defines the vertices for that are used to make up my cube but I need to scale these values by .6. Right now I just run through a loop and multiply each of the x vertices by .6 but I think it would make more sense to some just do a some sort of scale x call. So I assume I would get the transformation matrix and then give it a call that would look something like this: matrix.scaleX(.6) but I don't know. If I would have to enter the whole matrix that would be fine but does anyone know how I would do this? – Mike2012 Aug 24 '09 at 22:36

1 Answers1

1

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.

Steg
  • 10,000
  • 3
  • 24
  • 17