What do you want to achieve? In my game we have furniture placement. You can purchase an apartment, place your furniture, and then load it into any apartment you want with everything in its correct spot relative to the canvases position.
What is the issue? The problem I’m having is the furniture is not positioning relative to the canvases position. When a player saves their furniture data, it saves the positions x, positions y, positions z, rotation, and normal id. However when they try to load their apartment, it loads into coords and not relative to the canvas position.
What solutions have you tried so far? I have tried setting the cframe to the canvases cframe and multiplaying it by the coordinates.
if FindFurn then
-- V IS THE FURNITURES DATASTORE INDEX IN A FOR LOOP
local Pos = Vector3.new(V["Pos"]["X"], V["Pos"]["Y"], V["Pos"]["Z"])
FindFurn:SetPrimaryPartCFrame(CFrame.new(Pos, Pos + Dist) * CFrame.Angles(0, 0, math.rad(V["Rotation"])))
end
Heres an example of what I want to achieve. (I suck at explaining, hopefully this helps)
As you can see, even with the part it’s on being rotated differently and in a different place, it’s still in its relative position. This is what I want to achieve.
local BasePart = workspace.YourBasePart
local YourModel = workspace.YourModel
local ModelCFrame = YourModel:GetPivot()
--This gets the cframe offset of the model relative to the basepart. This is the information I think you want to save.
local Saved_Relative_CFrame = BasePart.CFrame:toObjectSpace(ModelCFrame)
--You can save the Saved_Relative_CFrame info however your like.
--Once you need it or load it, you can apply it to the model by doing the following:
YourModel:PivotTo(BasePart.CFrame * Saved_Relative_CFrame)
I explained in the code snippet but if you need further explanation just reply and let me know.