Answers.Body: <p>The position property is an array, which is a container with a number of components in it, in this case the three position values: x, y and z. To specify an array you use this notation <code>foo = [A,B,C]</code> where A, B and C are the individual values – constants, variables, whatevs. <strong>TL;DR</strong> to create an array you put a number of comma-separated values in square brackets.</p>
  
  <p>Conversely you can access any of the components of an array using this notation: <code>foo[n]</code> where foo is the name of the variable, and <code>n</code> is the <em>index</em> of the component you want. <strong>Note that the index starts at 0</strong>, so to get the first component of the array you would use <code>foo[0]</code>, the second <code>foo[1]</code> and so on. Arrays can also be multi-dimensional, so the address could be <code>foo[0][5][99]</code> for a three dimensional array. But you probably don't need to worry about that at this point.</p>
  
  <p>In your case you want just the third component to have the offset. So you need to unpick the original array using the <code>foo[0]</code>, <code>foo[1]</code>… notation and then put it back together as an array using the <code>[A,B,C]</code> notation. Thus:</p>
  
  <pre><code>thePos = comp("Main COMP").layer("text").transform.position;
  [thePos[0], thePos[1], thePos[2]+offset]
  </code></pre>
  
  <p>where <code>offset</code> is whatever your offset is, obviously.</p>
  
  <p>The first line is just for convenience - it assigns the position property as the value of the variable myPos. You could do it all on one line, but it gets a bit hard to read:</p>
  
  <pre><code>[comp("Main COMP").layer("text").transform.position[0], comp("Main COMP").layer("text").transform.position[1], comp("Main COMP").layer("text").transform.position[2]+offset]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-03T00:49:59.827Z
Answers.LastActivityDate: 2015-01-13T03:08:27.430Z
Answers.LastEditDate: 2015-01-13T03:08:27.430Z
Answers.UserDisplayName: stib
Body: <p>I have a 3D position property linked with another composition. I want the z-axis to have an offset in the linked expression. But how can I apply an offset just to one axis?</p>
  
  <p>The current expression of the 3D position:</p>
  
  <pre><code>comp("Main COMP").layer("text").transform.position
  </code></pre>
  
Tags: <after-effects>
Title: How to apply an offset to one axis only in 3D space for linked expression position?
UserDisplayName: membersound
ThreadText: # How to apply an offset to one axis only in 3D space for linked expression position?
  
  (Asked by: username_0 on 2015-01-01)
  
  I have a 3D position property linked with another composition. I want the z-axis to have an offset in the linked expression. But how can I apply an offset just to one axis?
  
  The current expression of the 3D position:
  
  ```
  comp("Main COMP").layer("text").transform.position
  
  ```
  
  **Tags:** after-effects
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-03. Score: 4 | Accepted answer
  
  The position property is an array, which is a container with a number of components in it, in this case the three position values: x, y and z. To specify an array you use this notation `foo = [A,B,C]` where A, B and C are the individual values – constants, variables, whatevs. **TL;DR** to create an array you put a number of comma-separated values in square brackets.
  
  Conversely you can access any of the components of an array using this notation: `foo[n]` where foo is the name of the variable, and `n` is the *index* of the component you want. **Note that the index starts at 0**, so to get the first component of the array you would use `foo[0]`, the second `foo[1]` and so on. Arrays can also be multi-dimensional, so the address could be `foo[0][5][99]` for a three dimensional array. But you probably don't need to worry about that at this point.
  
  In your case you want just the third component to have the offset. So you need to unpick the original array using the `foo[0]`, `foo[1]`… notation and then put it back together as an array using the `[A,B,C]` notation. Thus:
  
  ```
  thePos = comp("Main COMP").layer("text").transform.position;
  [thePos[0], thePos[1], thePos[2]+offset]
  
  ```
  
  where `offset` is whatever your offset is, obviously.
  
  The first line is just for convenience - it assigns the position property as the value of the variable myPos. You could do it all on one line, but it gets a bit hard to read:
  
  ```
  [comp("Main COMP").layer("text").transform.position[0], comp("Main COMP").layer("text").transform.position[1], comp("Main COMP").layer("text").transform.position[2]+offset]
  
  ```
  
  
  ---
  
  