# How to make Z axis parallel to a random vector - Kinematics

**URL:** <https://forum.universal-robots.com/t/how-to-make-z-axis-parallel-to-a-random-vector-kinematics/6552>\
**Category:** Technical Questions\
**Tags:** kinematics\
**Created:** [March 3, 2020, 8:55pm UTC](https://forum.universal-robots.com/t/how-to-make-z-axis-parallel-to-a-random-vector-kinematics/6552 "2020-03-03T20:55:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tulio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/tulio/32/1690_2.png) [@tulio](https://forum.universal-robots.com/u/tulio)\
**Post date:** [March 3, 2020, 8:55pm UTC](https://forum.universal-robots.com/t/how-to-make-z-axis-parallel-to-a-random-vector-kinematics/6552/1 "2020-03-03T20:55:26Z")

</div>

Hello guys…  
I’m trying to make my tool point to a certain direction given by the orientation of a vector. But I’m quite stuck in the math about the rotation.

A general question will be:  
Suppose I have an point A=[0,0,0] and an point B=[10,4,0], thus the vector AB = [-10,-4,0],

How to come out with the **pose’s rotation** that align my Z axis with this vector AB?

Can anybody help me, pleaseeee!

---

<div class="post-metadata">

**Author:** ![fujikit](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/fujikit/32/6042_2.png) [@fujikit](https://forum.universal-robots.com/u/fujikit)\
**Post date:** [March 3, 2020, 11:25pm UTC](https://forum.universal-robots.com/t/how-to-make-z-axis-parallel-to-a-random-vector-kinematics/6552/2 "2020-03-03T23:25:48Z")

</div>

Pose rotation is given by rotation vector [rx, ry, rz].

They can be obtained by calculating rotation matrix.  
I studied from here and read “Rotation vector”(page 17) of “Robotics in UR Robots\_March 2019.pdf”.

[https://forum.universal-robots.com/t/robot-theory-and-how-to-use-it-in-ur-robots/3863](https://forum.universal-robots.com/t/robot-theory-and-how-to-use-it-in-ur-robots/3863)
