Home | Up | Behavioral Editor | Body Editor | Line Chart | User Interface | How To: Add New Part | How To: World & Local Coordinates | Relabel | Data Array Chart | AnimatLab Scripting |

How To: World & Local Coordinates

This How To is designed to explain the differences between World and Local Coordinates.

When building an organism in AnimatLab there are two coordinate systems. A World Coordinate System and a Local Coordinate System.
First, lets explain what the coordinate systems are.

World Coordinate System
The World Coordinate system is global to the entire organism. That means that every body part can be referenced from the origin of the World Coordinate System, which resides at the center of the root body of your organism.
You can change the orientation of this coordinate system by clicking a dragging on black space in the 3D Display.

Local Coordinate System
The Local Coordinate System is relative to the origin of a body part's parent, which resides at the center of the parent body.
You can change the orientation of this coordinate system by right clicking and dragging on the center selection box of the currently selected body. You can also change the orientation by setting the rotation values in the properties panel.

There are two different coordinate systems to help in the placement of body parts. Sometimes you may want to place a body based on the root body part. Other times you may want to place a body based on it's parent body's location and orientation. This can best be described with pictures.

Initially, when you add a root body to an organism the World Coordinate System and the Local Coordinate System are the same. As you can see in the image below.




As you can see in the above image the World Orientation and the Local Orientation are the exact same. The positive x points to the right, the positive y points up, and positive z points through the screen. Typically, this is true for the root body of an organism. However, they can be different if you rotate the root body as shown below.




After rotating the root body -90 degrees around the y-axis you can see the Local and World Coordinate Systems no longer match. The Local Coordinate System now has the positive x pointing through the screen, the positive y pointing up, and the positive z point to the left.
Now lets see what happens when we add a child body to the root.



There's a couple of things to notice here. If you take a look at the Local and World locations you'll see that they are different. The Local Location is (10cm, 0cm, 0cm) whereas the World Location is (0cm, 0cm, -10cm). (Note: Normally you would not want to rotate a box for a root body. This would more often happen for irregular shapes such as a mesh object). So, if you were adjusting the position of yellow box to be 20cm to the right of the root body you could adjust the X component of the World Location accordingly. Or you could change the Z component of the Local Location accordingly. One place that two different coordinate systems come into place are for rotations that are a non multiple of 90 degrees. Let's rotate the yellow box 45 degrees around the y-axis.



Next, add a child body to the yellow box.



After adding the child body say we want to change location to the postive z side of the parent body. If you tried to do this via the World Cooridnates it wouldn't be that easy to do. Since there are Local Coordinates we can use, the job will be easier. All you have to is change the x compent of the Local Location to 0 and the Z component to 10cm.



As you can see once you start adding non multiple of 90 degree rotations things could get tricky to move. Local Coordinates should help in those type of situations.

Your Name Here © 2002 | All Rights Reserved |