📊
Game Content Creation
  • Introduction
  • Tools
  • Background
  • Triangulation and Triangle Reduction
  • Unwrapping
    • Unwrapping process
    • UVW Unwrap Modifier
    • Unwrapping the model
    • Packing the Stamp
  • Creating a texture from a stamp
  • Animation
  • MaxScript
    • Basic Syntax
    • MaxScript Objects and Modifiers
    • Translation, Rotation and Scale
    • UI
    • Mathematics of 3D Graphics
  • Appendix: Shortcut Keys
Powered by GitBook
On this page
  • Translation Rotation and Scale
  • Translation
  • Scale
  • Rotate
  • Angle axis
  • Quaternions

Was this helpful?

  1. MaxScript

Translation, Rotation and Scale

Translation Rotation and Scale

The three most commonly used transformations to an object are translation rotation and scale. This section will look in detail at how these work.

Translation

Translation is handled using the move function

move <object> <vector>

The object translates the object by vector

c = cone()    --c  is at 0,0,0
move c [0,1,0]  --after this line runs, c is at 0,1,0
move c [0,1,0]  --after this line runs, c is at 0,2,0

If you want to specify a absolute location for an object you can do so through its position property:

c = cone() --c is at 0,0,0
c.position = [0,10,0]  --after this line c is at 0,10,0
c.position = [0,10,0]  --after this line c is still at 0,10,0

Scale

An object can be scaled in the same way that it can be moved. call the scale function with the object and the vector to indicate how much to scale along each axis

c = cone()
scale c [2,2,2] -- makes c twice as big
scale c [2,2,2] -- makes c twice as big (4 times as big as original)

To do absolute scaling:

c=cone()
c.scale = [2,2,2]  -- makes c twice as big
c.scale = [2,2,2]  -- doesn't change c more than before

Rotate

There are also multiple modes of representing a rotation. This section looks at how rotations are represented.

Angle axis

Angle axis rotation states the rotation as an angle around a vector.

Imagine the vector as an axle that your object spins around. The axis runs through your object's pivot. The rotation then spins the object around the axle for the amount specified by the angle.

Angle axis requires specifying both the angle to spin and the vector to spin around. For example:

c=cone()
rotate c (angleaxis 60 [1,0,0])

the above will rotate c around the x axis for 60 degrees clockwise when viewed in the same direction as the vector for rotation.

Quaternions

Quaternions - holds rotations and a set of operations

Like angle axis, quaternions hold both the angle of rotation as well as the axis of rotation

PreviousMaxScript Objects and ModifiersNextUI

Last updated 4 years ago

Was this helpful?