I know that Workspace.B.CFrame = workspace.A.CFrame * CFrame.new((workspace.Part.Size.X/2+workspace.B.Size.X/2), 0, 0)
will offset the part so that part B is right beside part A.
What I want to do is rotate the part around that point. So basically, act as though there is a joint in between the two parts and rotate around it. It would also be useful to know how to change the offset of said 'joint' so that the pivot point is set to the top edge of part.
I did try Workspace.B.CFrame = workspace.Part.CFrame * CFrame.new((workspace.Part.Size.X/2+workspace.B.Size.X/2), 0, 0) * CFrame.Angles(0, 0, math.rad(45))
.
This didn't work the way I though it would. The rotation is obviously going to vary and will probably be on all axes.
Math isn't my strong suite so thanks a lot for the help.
Hi, AZDev, friend.
What I would do is use PrimaryPart
to make a model pivit.
You can do this either manually or with a script.
With a script, it would look like this:
local MODEL = workspace.MODEL MODEL.PrimaryPart = MODLE.Main -- "Main" would be the part to pivit around.
Or, set it manually:
-- Just click on the model a open the Properies tab and you should see "PrimaryPart". Click on PrimaryPart, hen select the pivit part, which would be "Main" like in the script.
Now, once you set the PrimaryPart, you may now use CFrame.Angles()
local MODEL = workspace.MODEL MODEL:SetPrimaryPartCFrame(MODEL:GetPrimaryPartCFrame() * CFrame.Angles(0,0,math.rad(45)))
If this helped, please be sure to accept :)