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

C-Framing a model to a exact Vector3 Position without rotating it?

Asked by
Nickoakz 231 Moderation Voter
10 years ago

Admins/Moderators, please do not close this and redirect me to "https://scriptinghelpers.org/questions/1485/c-framing-a-model-to-a-exact-vector3-position". That works to move my model, but it completely rotated it and made it face down into the floor. I'm serious, I'm on the verge of calling this project canceled.

Here is the code and the issue shown with pictures.

function GenerateCar()
    --pcall(function() LastCar:Destroy() end)
    script.Parent.Gen.BillboardGui.Frame.Visible=true
    script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Covering Area."
    local clone=game.ServerStorage.Car:clone()
    --Special CFramer
    do
        local modelCF=clone:GetModelCFrame()
        local targetCFrame=script.Parent.Cover.CFrame
        for i,v in pairs(clone:getChildren()) do
            if v:IsA("BasePart") then
                v.CFrame=targetCFrame:toWorldSpace(modelCF:toObjectSpace(v.CFrame))
            end
        end
    end
    --End of Special CFramer
    clone.Archivable=false
    wait()
    for a=.2,8.2,.2 do
        script.Parent.Cover.Size=Vector3.new(18,a,10)
        script.Parent.Cover.CFrame=script.Parent.Part.CFrame+Vector3.new(0,a/2,0)
        wait()
    end
    wait(.8)
    script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Generating Car."
    wait(.8)
    local model=Instance.new("Model",Workspace)
    model.Name="TCar"
    LastPos=clone.VehicleSeat.Position
    local all=clone:getChildren()
    for a=1,#all do
        if all[a]:IsA("BasePart") then
            all[a].Anchored=true
        end
        all[a].Parent=model
        wait()
    end
    model:MakeJoints()
    script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Uncovering."
    wait(.8)
--Continues on, but the problem occurs above.

Here is the image when the spawner finishes. Don't worry about the anchored parts, as its used for demonstrational purposes. http://postimg.org/image/y99n8bsbx/

0
I need help bump. Nickoakz 231 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Here. I tried the MoveTo() event. If this does not work then I will try a different remedy.

function GenerateCar()
    --pcall(function() LastCar:Destroy() end)
    script.Parent.Gen.BillboardGui.Frame.Visible=true
    script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Covering Area."
    local clone=game.ServerStorage.Car:clone()
    --Special CFramer
    do
        local v = clone:getChildren()
        local modelCF=clone:GetModelCFrame()
        local targetCFrame=script.Parent.Cover.CFrame
        for i= 1,#v do
            if v[i]:IsA("BasePart") then
                v[i].CFrame=targetCFrame:MoveTo(modelCF:MoveTo(v[i].CFrame))
            end
        end
    end
    --End of Special CFramer
    clone.Archivable=false
    wait()
    for a=.2,8.2,.2 do
        script.Parent.Cover.Size=Vector3.new(18,a,10)
        script.Parent.Cover.CFrame=script.Parent.Part.CFrame+Vector3.new(0,a/2,0)
        wait()
    end
    wait(.8)
    script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Generating Car."
    wait(.8)
    local model=Instance.new("Model",Workspace)
    model.Name="TCar"
    LastPos=clone.VehicleSeat.Position
    local all=clone:getChildren()
    for a=1,#all do
        if all[a]:IsA("BasePart") then
            all[a].Anchored=true
        end
        all[a].Parent=model
        wait()
    end
end
    model:MakeJoints()
    script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Uncovering."
    wait(.8)


0
You modified the cover, but the cover is not the problem. The parts of the vehicle literately appear one by one sideways and in the ground. But, here is the screen shot again, http://postimg.org/image/5p7e1wjcl/ Nickoakz 231 — 10y
0
Sorry I'm stumped. DhatBoiiPapi 10 — 10y
Ad

Answer this question