Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How to access the rotation of a CFrame?

Asked by 7 years ago

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

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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)
0
Thx this worked Wafflecow321 457 — 7y
Ad

Answer this question