Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 29 Oct 2017 12:56 PM |
I have two identical parts; part A and part B.
The two parts are in different positions and different rotations.
How would I take the rotation of part A and apply it to part B without changing the position of part B to that of part A?
I can't figure this out.
|
|
|
| Report Abuse |
|
|
|
| 29 Oct 2017 12:58 PM |
| parta cframe = partb cframe |
|
|
| Report Abuse |
|
|
Pastures
|
  |
| Joined: 15 Aug 2015 |
| Total Posts: 943 |
|
|
| 29 Oct 2017 01:00 PM |
That would change the position of Part A to Part B. I do not want the two parts to have the exact same position, just the same rotation.
How do I separate the rotation from the position in a CFrame?
|
|
|
| Report Abuse |
|
|
D3D9
|
  |
| Joined: 20 Aug 2016 |
| Total Posts: 87 |
|
|
| 29 Oct 2017 01:02 PM |
#code local part1, part2 = workspace.part1, workspace.part2; part1.CFrame = (CFrame.new(part1.CFrame.p) * (part2.CFrame - part2.CFrame.p));
|
|
|
| Report Abuse |
|
|
|
| 29 Oct 2017 01:02 PM |
--Get the displacement of the parts' positions local disp = partB.Position - partA.Position
--Then, set B CFrame to A CFrame, and offset it by the original displacement partB.CFrame = partA.CFrame + disp
|
|
|
| Report Abuse |
|
|
Relymx
|
  |
| Joined: 04 Apr 2010 |
| Total Posts: 12 |
|
|
| 29 Oct 2017 01:05 PM |
| b.CFrame = (a.CFrame - a.Position) + b.Position |
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 29 Oct 2017 01:09 PM |
Exactly what I was looking for! Thanks guys!
|
|
|
| Report Abuse |
|
|