# Calculating Orientation

Hello! I’m relatively new to CFrames and I couldn’t find anything on what I’m asking.

I’m trying to find out a way to make a part that has a different orientation match another part’s orientation without changing the orientation of the original part.

2 parts are rotated to face the same direction, but they both have different orientations.

If I set them to the same it looks like this:

Part1 has an orientation of 0, 0, 0
and
Part2 has an orientation of 0, 90, 0

Is there a way I can calculate them to look the same in a script to make it automatic?

I’m bad at describing things, I apologize if this thread if all over the place.

Well without need of CFrame, you can set the 2nd part’s `Orientation` property to the 1st’s.

``Part1.Orientation = Part2.Orientation``

I presume you want to keep the position of both parts different, bit you can use the ` part.CFrame.lookVector` property to get a part’s pointing direction.

Use it in this case, like this.

``````part1.CFrame = CFrame.new( part1.Position, part2.CFrame.lookVector * 999)
``````

Then it looks like this:

To match the orientation it has to be 0,180,0 for some reason, I’m trying to figure out a script method to that automatically so I don’t have to keep doing it.

Also same with the guy’s response above.

I think I might have to do something with offset, not sure.

Oh just realised you said they don’t face the same direction.

Since even if they have different rotations, their dimensions shouldn’t change (meaning the width would be the same width, and same thing for length and height), so you can set the 2nd part’s size to the 1st’s, with the changing of the rotation

``````Part1.Size = Part2.Size
--I think this would work``````

Shouldn’t the second Cframe argument there be part1.Position+part2.CFrame.LookVector?
The second argument is the position to face, the look vector is an offset from the origin / unit vector.

1 Like

The short answer is no. The reason is that the two parts have misaligned surfaces. The Front surface of Part1 does not match the Front surface of Part2. This isn’t too descriptive but let me know if you have any questions.