Game Development Community

Rotation object/image that is in mount

by KLEBER SEIXAS · in General Discussion · 06/18/2007 (2:42 pm) · 1 replies

I am wanting to turn an object/image that this in one mount. how I make this?

#1
07/12/2007 (10:03 pm)
When its mounted, I don't think you can move it. But try this anyway
function turnImage(%this,%slot,%xrot,%yrot,%zrot)
{
   %image = %plr.getMountedImage(%slot); // Its mounted to slot zero, right?
   %trans = %image.getTransform();
   %pos = getWords(%trans,0,2); // Its xyz position in the world
   %rot = getWords(%trans,3,5); // Its xyz rotation in the world
   %newRot = %xrot SPC %yrot SPC %zrot;
   %newTrans = %pos SPC %newRot SPC "0";
   %image.setTransform(%newTrans); // Apply the transformation
}
Arguments:
%slot: What image slot the image is mounted to on the player
%xRot: the number of degrees to rotate on the x axis
%yRot: the number of degrees to rotate on the y axis
%zRot: the number of degrees to rotate on the z axis
Example:
%this.turnImage(0,"10","20","5");