Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to access the rotation of a CFrame?

So Have to parts that are at different positions and I want there CFrame Rotations to match but not the positions. The positions should stay different and the rotations should be the same. I was thinking I would just find the rotation property of the parts Cframe and copy it into the other part. But I dont know how to do this, any help. This was basically my idea 4 my script.

Part1.CFrame = Part1.CFrame * Part2.CFrame(Something Here I dont know what)

Thats what im thinking but it dont know what to put in

1 answer

✓ Accepted answer

Subtract the other object's Position from it's CFrame and you're left with it's Orientation(Rotation).

Multiply this orientation by the current part's position.

part1.CFrame = CFrame.new(part1.CFrame.p) * (part2.CFrame - part2.CFrame.p)

1 comment

0

Thx this worked

This discussion is preserved as it was. New answers, comments, and votes are closed.