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

Changing a CFrame to a Vector then back to a CFrame?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

Alright so let me explain what I'm trying to do. I made a placer that places a model via SetPrimaryPartCFrame(), right but I don't want the item I'm placing to clip into the ground (because it's only checking the primary part) Example:

Currently when I try to place an object: http://prntscr.com/9ldx6h

What I want it to look like when I try to place an object: http://prntscr.com/9ldwob

function updatePlacing()
    if currentlyPlacing == true then
        if previous ~= nil then previous:Destroy() end
        if itemSetName ~= nil then
            item = itemSetName:Clone()
            previous = item
            for i,v in pairs (item:GetChildren()) do
                if v:IsA("Part") then
                    v.Transparency = .7
                    v.BrickColor   = BrickColor.Green()
                    v.CanCollide   = false
                end
            end
            item.Parent = Character
            item:SetPrimaryPartCFrame(CFrame.new(Mouse.hit.p)*CFrame.Angles(currentTilt,currentRotation,0)) --Dis line
        end
    end     
end

Answer this question