站在砖上举起动画[ROBLOX]

时间:2016-08-21 17:56:55

标签: animation lua roblox

当你站在砖头上时,我需要一个可以制作动画的脚本。我只是不知道怎么做动画。我找不到一个我正在寻找的动画的免费模型。这是我想要举手的预览。 PREVIEW OF THE ANIMATION

你所站的砖是

script.Parent

1 个答案:

答案 0 :(得分:0)

动画有两种主要方式;较新的Animations和较旧的Joints

guide应该可以帮助您开始使用动画。它甚至得到video

如果你想使用旧式联合动画,这样的东西可能会起作用:

local Block = script.Parent

local function MakeFakeShoulder(Character, Side)
    local Controller = { ["Stop"] = function() end }

    local Torso = Character:findFirstChild("Torso")
    local Arm = Character:findFirstChild(Side .. " Arm")

    if not Torso or not Arm then return Controller end

    local Shoulder = Torso:findFirstChild(Side .. " Shoulder")
    if Shoulder then
        local FakeShoulder = Instance.new("ManualWeld")
        FakeShoulder.Name = "Fake " .. Side .. " Shoulder"
        FakeShoulder.C0 = CFrame.new(1.5 * (Side == "Right" and 1 or -1),0.5,0)
        FakeShoulder.C1 = CFrame.new(0,0.5,0) * CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.Z), math.rad(-180))
        FakeShoulder.Part0 = Torso
        FakeShoulder.Part1 = Arm
        FakeShoulder.Parent = Torso

        Shoulder.Parent = nil

        function Controller:Stop()
            Shoulder.Parent = Torso
            FakeShoulder:Destroy()
        end
    end
    return Controller
end

local function MakeFakeShoulders(Character)
    local Controller = { }

    local Right = MakeFakeShoulder(Character, "Right")
    local Left = MakeFakeShoulder(Character, "Left")

    function Controller:Stop()
        Right:Stop()
        Left:Stop()
    end

    return Controller
end

local function GetHumanoid(Part)
    if Part.Parent == nil then return nil end
    return Part.Parent:findFirstChild("Humanoid")
end

local CurrentlyTouching = { }
Block.Touched:connect(function(Part)
    local Humanoid = GetHumanoid(Part)
    if not Humanoid then return end

    CurrentlyTouching[Humanoid] = CurrentlyTouching[Humanoid] or 0
    CurrentlyTouching[Humanoid] = CurrentlyTouching[Humanoid] + 1
    if CurrentlyTouching[Humanoid] > 1 then return end

    local Controller = MakeFakeShoulders(Part.Parent)   

    while CurrentlyTouching[Humanoid] > 0 do
        if GetHumanoid(Block.TouchEnded:wait()) == Humanoid then
            CurrentlyTouching[Humanoid] = CurrentlyTouching[Humanoid] - 1
        end
    end

    Controller:Stop()
end)

请注意,如果结束触摸的注册效果不够好,请创建一个比可视部分大的不可见CanCollide = false边界部分,然后将脚本放入该部分,