// ========================================================================
//  turnshape.cs
//
//  This module contains a function for turning a specified shape.
// ========================================================================

function TurnShape(%shape, %angle)
// ----------------------------------------------------
//     turns the %shape by %angle amount.
// ----------------------------------------------------
{
   echo ("TurnShape: shape id: ", %shape);
   echo ("TurnShape: angle: ", %angle);
   %xfrm = %shape.getTransform();
   %lx = getword(%xfrm,0); // first, get the current transform values
   %ly = getword(%xfrm,1);
   %lz = getword(%xfrm,2);
   %rx = getword(%xfrm,3);
   %ry = getword(%xfrm,4);
   %rz = getword(%xfrm,5);
   %angle += 1.0;          // increment the angle (ie. rotate it a bit)
   %rd = %angle;           // Set the rotation angle
   %shape.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd);
   echo ("TurnShape: done.");
}

