# How to align Z axis of two actors?

**URL:** <https://forums.unrealengine.com/t/how-to-align-z-axis-of-two-actors/321430>\
**Category:** Community & Industry Discussion\
**Tags:** rotation, align, axis, unreal-engine, question\
**Created:** [June 11, 2015, 5:52pm UTC](https://forums.unrealengine.com/t/how-to-align-z-axis-of-two-actors/321430 "2015-06-11T17:52:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperRey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SuperRey](https://forums.unrealengine.com/u/SuperRey)\
**Post date:** [June 11, 2015, 5:52pm UTC](https://forums.unrealengine.com/t/how-to-align-z-axis-of-two-actors/321430/1 "2015-06-11T17:52:32Z")

</div>

Hello,

I have an actor with two sockets defined. On each of these sockets there are two other actors. Each of these socketed actors have their z axis (Up direction) pointing in a direction of my interest, relative to the parent actor.

What I want to do is to align two parent actors, by the actor in the sockets I click, facing each Z axis to the opposite.

I have started implementing this calculating the cross product of the Up direction of each socketed actor, to use it as a axis rotator, and then calculating the angle between them, but it seems that I have to take into consideration many cases (cross product being a 0 vector, angle sign, etc).

Is there a more direct way to do this calculations?
