# Expression to offset rotation based on position

**URL:** <https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438>\
**Category:** Flame Questions\
**Tags:** expressions\
**Created:** [May 24, 2023, 12:31am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438 "2023-05-24T00:31:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeyBrown](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@MikeyBrown](https://forum.logik.tv/u/MikeyBrown)\
**Post date:** [May 24, 2023, 12:31am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/1 "2023-05-24T00:31:29Z")

</div>

Created a simple spherical eye ball in action. I have the x and y rotation of the eye linked to a dummy axis (LOOK\_AT) and all working well. However the rotations only work as intended when the eye is in the middle of the frame. Ideally within the expression (or a second dummy axis) is something which compensates for the rotation of the eye based on its position. End result being a bunch of eye balls in different positions all looking at the same point.

Current expression for x rotation is:  
LOOK\_AT.position.y\*-0.05

and y rotation is:  
LOOK\_AT.position.x\*0.05

I won’t mention the Z words just yet…

---

<div class="post-metadata">

**Author:** ![ytf](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/ytf/32/109_2.png) [@ytf](https://forum.logik.tv/u/ytf)\
**Post date:** [May 24, 2023, 2:23am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/2 "2023-05-24T02:23:00Z")

</div>

I believe that in the rotation channel of the eyeball you simply enter the expression lookat(object.position,eyeball.position). In fact, to make it simpler, you can just enter lookat(object.position,position). You can then copy that eyeball and it’s axis endlessly and each copy will follow the same object.

---

<div class="post-metadata">

**Author:** ![MikeyBrown](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@MikeyBrown](https://forum.logik.tv/u/MikeyBrown)\
**Post date:** [May 24, 2023, 2:53am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/3 "2023-05-24T02:53:54Z")

</div>

Hi @ytf. Not sure what i’m doing wrong but currently getting an error saying ‘uknown channel position’ when i try that

---

<div class="post-metadata">

**Author:** ![ytf](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/ytf/32/109_2.png) [@ytf](https://forum.logik.tv/u/ytf)\
**Post date:** [May 24, 2023, 11:46am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/4 "2023-05-24T11:46:56Z")

</div>

Your expressions must not be referring to the axii with their correct names.

---

<div class="post-metadata">

**Author:** ![ytf](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/ytf/32/109_2.png) [@ytf](https://forum.logik.tv/u/ytf)\
**Post date:** [May 24, 2023, 2:54pm UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/5 "2023-05-24T14:54:31Z")

</div>

Of course, there’s always the Lookat link, but it’s restrictive.

---

<div class="post-metadata">

**Author:** ![MikeyBrown](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@MikeyBrown](https://forum.logik.tv/u/MikeyBrown)\
**Post date:** [May 25, 2023, 5:22am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/6 "2023-05-25T05:22:40Z")

</div>

yeh ‘look at’ for my first port of call but didnt work as needed. will investigate further into the error. thanks so much @ytf

---

<div class="post-metadata">

**Author:** ![ytf](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/ytf/32/109_2.png) [@ytf](https://forum.logik.tv/u/ytf)\
**Post date:** [May 25, 2023, 11:13am UTC](https://forum.logik.tv/t/expression-to-offset-rotation-based-on-position/8438/7 "2023-05-25T11:13:30Z")

</div>

Also bear in mind that flame does not concatenate. If the object that the eyeball is looking at is the child of another axis and you move the parent, flame does not create data for the new position of the child.
