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

Move replica model with additions to the exact same place as another model?

Asked by
TomsGames 225 Moderation Voter
10 years ago

Model bc = bluecar Model ebc = editbluecar

ebc:MoveTo(bc:GetModelCFrame()) doesn't work as MoveTo uses Vector3.. But I also want the model to be rotated. Yet I am taking into account the cframe of a model is the center, it's the same size (a replica) just with an addition.

TY!

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

To move model1 to model2

model1=Model
model2=Model

local a=model1:GetModelCFrame()
local b=model2:GetModelCFrame()
local c=a*b:inverse()
function getparts(m)
    for _,v in pairs(m:GetChildren())do
        if v:IsA("BasePart")then
            v:BreakJoints()
            v.CFrame=c*v.CFrame
            v:MakeJoints()
        end
        getparts(v)
    end
end
getparts(model1)
Ad

Answer this question