# Blog

## The Maya Move Command

Posted by:

As per usual Autodesk documentation on this is abysmal.  The following explanation of the absolute flag is taken directly from the Autodesk website:

absolute(a)
Perform an absolute operation

Are you kidding me Autodesk?  That’s bush league man!  You couldn’t get away with that in 3rd grade.  You get an F!

So I did extensive research and experimentation with the move command and as I did so I wrote out my notes, and here they are, you are welcome.

First of all, translating an object uses the “move” command while rotating and scaling an object use “rotate” and “scale” respectively.  Why the difference in keywords that breaks the convention?  Because Autodesk dude, that’s why.

Anyway, with the move command the devil is in the modifiers.  In order to understand the modifiers you have to get your head around coordinates, units and spaces, how those are related and how they are different.  Coordinates are a point in space. Units are the measurement of the space for the coordinates and the space is the position, orientation and size that the units are based on.  All of the modifiers in the move command are ways in which you can frame the message you are sending to the object.  Think of it like this, if I tell you to take two steps forward it doesn’t matter where you are, you can just take two steps forward relative to your current position.  But if I told you to take two steps West, that’s very different.  Now you have to know where you are relative to the world and you have to move within that space.  Now let’s say you are on a spaceship orbiting the planet and I told you to take two steps toward the front of the ship.  Now you need to know where you are in relationship to the spaceship.  This is the essence of how you need to think about the move command to get your head around it.  Throughout this discussion I will be using the metaphor of you, the spaceship and the world to make sense of the move command.  The world is the space in which the spaceship exists and the spaceship is the space in which you exist.  You are being told where to go using the move command.  The command that you are being handed will have values and flags.  I’m going to explain what each of the flags does so that you can make sense of your instructions.

absolute means that the operation is performed using world space coordinates and units.  That means that it doesn’t matter how the object is parented, it doesn’t matter what the scale of the parent object is or how it is rotated, the absolute flag by itself will snap the object to the world space coordinates that you specify.  So let’s say that the instructions are to go to a location on the planet.  We don’t care where we are, we just care where we are going.  Using the absolute command you are going to be beamed to the location on the surface of the planet relative to the planet (world space).  Absolute is the default value for worldSpace, localSpace and objectSpace, more on that later.

relative means that you are performing an additive command.  The object will be offset from its current position by the amount specified.  However, the object is still moved in world space units and coordinates.  You might think that “relative” means that it takes into account the hierarchy in which the object exists.  But it doesn’t.  Like absolute it doesn’t matter what is going on with the parent object.  This would be instructions like “Move two meters West”  We are dealing with Units that are based off of the world and we are also dealing with a coordinate system based off of the world but we are telling the object to move from its current location using world space and world units regardless of what the parent object is doing and also regardless of how the moved object is oriented or scaled.  The object could be microscopic, upside down and parented under another object but it would still move two meters west.

worldSpace does is the same thing as absolute, so why have both?  There may be no reason.  But this is a good time to mention that you can combine flags.  You can use worldSpace with relative and what that means is that your object will move in world space coordinates but relative to its current position (which is also the default behavior of just plain relative).  So imagine an object parented under a group.  The group (the parent) is somewhere in space,  scaled and rotated.  If you were to use the move command with just the worldSpace flag then it would simply move to the world space coordinates that you specified.  If however you combined worldSpace with relative then the object would use its initial position and add the values that you specified to change position.  However, even though the parent object is scaled and rotated–the child object that the script is affecting will still move in world space coordinates, just with an offset from its current position.  You would use this in a situation in which you have an object that is parented, but you want to move it in world space coordinates regardless of the parent object’s transform values.  As I said, this is the default behavior of the relative flag and just world space is also the same as absolute.  Sooo, I don’t know, worldSpace may be totally unnecessary, let me know if you find a use for it that only it can do.

objectSpace takes the object’s entire transform into account and uses the values you pass to move the object relative to its current position orientation and scale.  objectSpace on its own will snap the object to the translation value that it is passed which is what you would expect of the addition of absolute and in fact adding absolute does nothing so we can assume that absolute is the default setting.  When objectSpace is combined with relative the translate values passed will be added to the current position of the object.  The instructions for this command would be of the type “Take two steps forward”  Whatever your current orientation, whatever your current scale, no matter what you are parented under or how it is oriented–take two steps forward relative to yourself.  Note that the object will move forward relative to its own scale and orientation.  If it is at .5 scale then the step will be .5 of the world metric.  If the Z axis (the forward axis) is pointed down the X axis then it will travel down the X axis.  The transform values of the object’s parent are also irrelevant.

localSpace moves the object in its parent’s space.  As with objectSpace the default flag for this is absolute.  That is to say that it will snap to the position specified in the move statement relative to the origin of the parent’s transform.  If the parent is rotated then the object will move along the axis of the parent.  If the parent is scaled the object will move in units based on the scale of that object.  For instance if the parent object is .5 in scale and you tell the object to move forward 1 unit then it will only move .5 in the worldSpace because the space in which the object exists is half the size and so are its units and so is its coordinate system.  This is the sort of argument that might be:  “Go to center of the spaceship”  It doesn’t matter where the object is currently, how it is oriented or how big it is.  It is a child of the parent and the instructions are to just go to the center of the parent.  Now if you add relative to localSpace it becomes an additive.  The statement is now something like “Walk two floor tiles toward the front of the ship”  We are saying from where you are standing use the parent’s current size position and rotation to move two units of the parent’s coordinate system toward the front of the parent.  Again, here it doesn’t matter where the child is, what direction it is facing or how big it is.  We are only concerned with what is going on with the parent’s transform and how we are moving in it.

Although maya will allow you to do something like combine relative with absolute or worldSpace with localSpace it will choose one to override the other.  world and absolute will trump local and relative.

Some of them make sense and some of them don’t but they can all be combined together even contradictory ones like absolute and relative or worldSpace and localSpace