# Rotate a shape so that it is parallel with another object's edge

I have two shapes. Think of the bigger shape as the "chassis", and the longer, narrower shape as the "axle". Together they look like this:

And, from the side, they look like this:

As you can see, the axle is a more complex shape. The edge highlighted below has an arbitrary angle:

Now I would like to rotate the chassis so that its bottom edge matches the angle of the highlighted edge. Here's my best attempt at doing so by hand to demonstrate what I mean:

How can I determine the exact angle of the highlighted edge on the axle so that I can rotate the chassis by exactly that amount?

• you could create a custom orientation on this face, then align the big object with this orientation Commented Oct 25, 2021 at 5:47

It can be difficult to match rotations exactly. I strongly recommend doing it to eye, which is good enough for almost any kind of work.

Every once in a while, it's necessary to orient two faces exactly, in a situation where our object local axes aren't working for us. It's possible, but it's not as easy as it should be.

We'll start by marking the axes we need with vertex groups. In each mesh object, create three vertex groups, "face", "front", and "right". For all vertices of the face you want to match, assign them to face. For the frontmost vertices of this face, assign them to front. For the rightmost vertices of this face, assign them to right.

Now create two empties. We'll call these empties "copy" and "paste". Create three object constraints for each empty. Each empty should copy location from face, damped track -Z to front, and locked track (lock Z, track +X) to right. Each empty's constraints should be targeting a different object:

Copy targets the object we wish to use to get the transforms, that we don't want to modify. Paste targets the object we wish to transform.

We now have two empties representing the face orientation of these faces. Now, for the empty targeting the object you wish to modify, apply visual transform, then delete all constraints.

Now parent the object-to-be-transformed to the paste empty. Then give the paste empty a copy rotation constraint targeting the copy empty:

That object is now oriented with the face we wanted. We can unparent the mesh object with keep transforms if we want, and then delete the empties.

Notice that it rotated the object about the center of the face that we wanted to match. That position might not be what you want. If not, you can adjust the position of the paste empty in local orientation before unparenting.