Hi,

here’s how you align one vector with another using quaternions and haxe:

```
var v1 = new Vec4(0, 1, 0, 0);
var v2 = new Vec4(0.707, 0.707, 0, 0);
q = new Quat();
// calculate Quaternion which transforms v1 to v2
q.fromTo(v1,v2);
q.normalize();
// sanity check, transform v1 using the calculated quaterion
var v = new Vec3(v1.x, v1.y, v1.z);
n = qMult(q, v);
// result must be v2
trace(n);
```

I did not find a haxe method to apply the quaternion to a Vec3 so I implemented qMult as follows:

```
public function qMult(quat:Quat, vec:Vec3): Vec3{
var num = quat.x * 2.0;
var num2 = quat.y * 2.0;
var num3 = quat.z * 2.0;
var num4 = quat.x * num;
var num5 = quat.y * num2;
var num6 = quat.z * num3;
var num7 = quat.x * num2;
var num8 = quat.x * num3;
var num9 = quat.y * num3;
var num10 = quat.w * num;
var num11 = quat.w * num2;
var num12 = quat.w * num3;
var result = new Vec3();
result.x = (1.0 - (num5 + num6)) * vec.x + (num7 - num12) * vec.y + (num8 + num11) * vec.z;
result.y = (num7 + num12) * vec.x + (1.0 - (num4 + num6)) * vec.y + (num9 - num10) * vec.z;
result.z = (num8 - num11) * vec.x + (num9 + num10) * vec.y + (1.0 - (num4 + num5)) * vec.z;
return result;
}
```

source: https://answers.unity.com/questions/372371/multiply-quaternion-by-vector3-how-is-done.html