# Applying Standard Transformations

Now that you know how to create and modify the basic properties of a box, you need to learn how to apply the standard transformations (move, scale, and rotate) to it. It is possible to designate position, size, and orientation when the box is created; however, you can also carry out these operations after you have created your object, just as you would in 3ds Max.

## Moving the Box

Moving an object in MAXScript is very simple:

move name_obj [<x,y,z>]

where name_obj is the name of the object you want to move and <x,y,z> is the amount you want it to move. It is important to note that you are not moving the object to <x,y,z>, but by the amounts <x,y,z>. Therefore, if you apply the move function more than once, the object continues to move. This is also true for the scale and rotate transforms. This is in contrast to setting a property of an object. If you set the object position, scale, and rotation properties several times, the object won’t change, assuming that you assign the same value each time.

For example:

mybox.pos = [10,0,0]

mybox.pos = [10,0,0]

mybox.pos = [10,0,0]

will only change the position of your box after the first line is executed. The second and third lines do not affect the position of your box, as they do not change the position of the box. If you entered the above commands, click Undo three times to move the box back to its original position.

On the other hand, entering:

move mybox [10,0,0]

move mybox [10,0,0]

move mybox [10,0,0]

will move your box 30 units along the X-axis. If you entered the above commands, click Undo three times to move the box back to its original position.

## Scaling the Box

Scaling is performed in a similar manner:

scale name_obj [<x,y,z]

where name_obj is the name of the object and <x,y,z> is a 3D coordinate that corresponds to the amount you would like to scale the object along the X, Y, and Z-axis, respectively. Again, the scale transformation is different from the scale object property. Setting the object’s scale property (name_obj.scale = …) repeatedly with the same values will only scale the object the first time, but applying the scale transformation repeatedly will continue to scale the object.

## Rotating the Box

The rotate transformation is not as simple as the move and rotate transforms. In fact, there are three ways to rotate an object in MAXScript:

Euler Angles

Quaternions

Angleaxis

This document will only consider Euler Angles. If you would like further information on any of these transformations, see the MAXScript reference.

To apply a rotation transform in MAXScript, you must first define the rotation as a sort of rotation object, and then apply the rotation object to the object you want to rotate. The rotation object is defined in the following way:

rot_obj = eulerangles x y z

where rot_obj can be any name and x, y, and z represent the amount you want to rotate your object (in degrees) around the X, Y, and Z-axes, respectively.

For example:

rot_box = eulerangles 0 30 0

creates an object called rot_box, which will rotate an object around the Y-axis by 30 degrees. This rotation can be applied to your box in the following way:

rotate mybox rot_box In fact, this rotation could be applied to any object by writing the same line as above and replacing mybox with the name of the object you want to rotate.

If you entered the above commands, click Undo to move the box back to its original position.

If you designate angles for more than one axis:

rot_box2 = eulerangles 30 45 60

The rotation is applied to an object, with the X-axis rotation occurring first, followed by the Y-axis rotation, and then the Z-axis rotation.

Note: Moving, scaling, or rotating objects, or setting transform-related properties operates in the World Coordinate System, by default. If you want to perform these transformations in another coordinate system, see Coordsys.

Next Topic