【问题标题】:Hands up animation when stand on a brick [ROBLOX]站在砖块上时举起手动画 [ROBLOX]
【发布时间】:2016-12-28 06:40:45
【问题描述】:

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

你站的砖是

script.Parent

【问题讨论】:

    标签: animation lua roblox


    【解决方案1】:

    动画主要有两种方式;较新的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 边界部分,然后将脚本放在那个部分中,

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-14
      • 2023-02-18
      • 2018-06-14
      • 1970-01-01
      • 2021-03-21
      • 1970-01-01
      • 1970-01-01
      • 2020-12-20
      相关资源
      最近更新 更多