# Access vector axis in Math Expression node

**URL:** <https://forums.unrealengine.com/t/access-vector-axis-in-math-expression-node/331162>\
**Category:** Blueprint\
**Tags:** math-expression, unreal-engine, vector, Blueprint, question\
**Created:** [September 5, 2015, 3:50pm UTC](https://forums.unrealengine.com/t/access-vector-axis-in-math-expression-node/331162 "2015-09-05T15:50:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nallebeorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nallebeorn](https://forums.unrealengine.com/u/Nallebeorn)\
**Post date:** [September 5, 2015, 3:50pm UTC](https://forums.unrealengine.com/t/access-vector-axis-in-math-expression-node/331162/1 "2015-09-05T15:50:18Z")

</div>

I know it’s possible to use vector inputs and outputs in Math Expression nodes. But is there a way to access a certain axis of an input vector?

I tried `a.x` as well as `a[x]` – unfortunately, none of them worked (instead they throw the parse error _Unhandled trailing ‘.x’ / ‘[x]’ at the end of expression_).

Is there a syntax for this, or is is simply not supported?

---

<div class="post-metadata">

**Author:** ![idbrii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@idbrii](https://forums.unrealengine.com/u/idbrii)\
**Post date:** [October 14, 2015, 9:39pm UTC](https://forums.unrealengine.com/t/access-vector-axis-in-math-expression-node/331162/2 "2015-10-14T21:39:09Z")

</div>

I would guess `a[0]` might give you the x component, but that doesn’t work either. (The `[]` postfix operator is supposed to be supported, but I don’t see what it would do since arrays are not supported and it doesn’t work with vectors.)

`a.X` would match the C++ (the variable is upper case), but that doesn’t work.

It seems like none of the common vector functions (dot product) are available either. I think you need to write your own: [Any BlueprintPure function defined in a UBlueprintFunctionLibrary will be callable using this node](https://forums.unrealengine.com/showthread.php?8435-A-math-formulae-node&p=72687&viewfull=1#post72687). You’d have to make it a loose function taking the vector as an input: `float GetX(const Vector& v)`

---

<div class="post-metadata">

**Author:** ![grisevg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grisevg](https://forums.unrealengine.com/u/grisevg)\
**Post date:** [October 27, 2015, 5:23pm UTC](https://forums.unrealengine.com/t/access-vector-axis-in-math-expression-node/331162/3 "2015-10-27T17:23:24Z")

</div>

This would be an incredibly useful feature, especially for shaders.

---

<div class="post-metadata">

**Author:** ![Emingo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Emingo](https://forums.unrealengine.com/u/Emingo)\
**Post date:** [July 12, 2016, 5:28am UTC](https://forums.unrealengine.com/t/access-vector-axis-in-math-expression-node/331162/4 "2016-07-12T05:28:03Z")

</div>

Hope this gets implemented!
