This is correct behavior. I will explain why:

A) your object has 3 local axis (vectors), you defined Y as the vector to be aligned

B) you want to turn the object that the “vector to be aligned” is parallel to the “alignment vector”

First you need to determine the “alignment vector”. As Josip already posted, do not confuse a vector with a point in space. A vector itself has no location. It is a direction and a length. A point has no length or direction. A point in space is usually described as a vector starting from a reference point (usually the origin). Such vectors are called location vectors. So you simply “add” a vector with a given point. As the origin is (0,0,0) the terms of the resulting location vector matches the terms of the vector itself.

In your case you need the vector not the point. When your target point is not in origin you can get the vector by subtracting the location of the *object to align to* with the location of the *object to be aligned* (vectors in world space).

Example:

```
alignmentVector = hitPosition - owner.worldPosition
```

Btw. the length of the vector does not matter as long as it is non zero (Null vector).

“Aligning” an object along an vector is not unique.

The object can have any orientation as long as “vector to be aligned” is parallel to the “alignment vector”. This is exactly what you describe. The image shows you that.

To make this operation unique you need an additional parameter. Usually you define an “up-vector”. The up-vector is an axis of the object that is not parallel to the “vector to be aligned”. To make it easier a common choice is one of the other axis.

As the name “up”-vector indicates this vector should point along global Z.

How to do this in code?

This is pretty simply:

- you align the objects “up-vector” with “global Z”
- you align the objects “vector to be aligned” to the “alignment vector”

```
from mathutils import Vector
X = 0
Y = 1
Z = 2
GLOBAL_Z = Vector([0,0,1])
...
alignmentVector = hitPosition - owner.worldPosition
upVector = GLOBAL_Z
owner.alignAxisToVect(upVector, Z)
owner.alignAxisToVect(alignmentVector, Y)
```

**Attention:** This solution still has two non-unique situations. This is when the “alignment vector” is parallel to the global Z-Axis.

I guess this can be solved by aligning the remaining local axis (X) along global X or global Y first.