home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / CH3 / moveshape.cs < prev    next >
Encoding:
Text File  |  2006-06-29  |  828 b   |  22 lines

  1. // ========================================================================
  2. //  moveshape.cs
  3. //
  4. //  This module contains a function for moving a specified shape.
  5. // ========================================================================
  6.  
  7. function MoveShape(%shape, %dist)
  8. // ----------------------------------------------------
  9. //     moves the %shape by %dist amount
  10. // ----------------------------------------------------
  11. {
  12.      echo ("MoveShape: shape id: ", %shape);
  13.      echo ("MoveShape: distance: ", %dist);
  14.    %xfrm = %shape.getTransform();
  15.    %lx = getword(%xfrm,0); // get the current transform values
  16.    %ly = getword(%xfrm,1);
  17.    %lz = getword(%xfrm,2);
  18.    %lx += %dist;          // adjust the x axis position
  19.    %shape.setTransform(%lx SPC %ly SPC %lz SPC "0 0 1 0");
  20.      echo ("MoveShape: done.");
  21. }
  22.