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

How would i make R15 arms connect to the steering wheel when sat down?

Asked by 5 years ago

So basically i made a go kart and i want my custom R15 characters arms to realistically turn with the steering wheel as soon the player sits down and go back to normal when the player comes off.Is the possible???? I cant get my head around it :(

0
Learn Inverse Kinematics. FABRIK and the law of cosines can help you spr_ead 47 — 5y
0
CFrame ProjectJager 62 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Im really close? It looks bad though as i want it to weld to the body too ;///

--[[Dependencies]]

    local player = game.Players.LocalPlayer

    local mouse = player:GetMouse()                                                 ---IGNORE
    local UserInputService = game:GetService("UserInputService") ---IGNORE
    local car = script.Parent.Car.Value                                               ---IGNORE
    local _Tune = require(car["GoKartChassisTune"])                       ---IGNORE

    local character = player.Character
    local LeftArm = character:FindFirstChild("LeftUpperArm")
    local RightArm = character:FindFirstChild("RightUpperArm")

--[[Shutdown]]

    car.DriveSeat.ChildRemoved:connect(function(child)
        if child.Name=="SeatWeld" and child:IsA("Weld") then
            script.Parent:Destroy()
            character["LeftUpperArm"].Transparency = 0
        character["RightUpperArm"].Transparency = 0

        local Weld = car.Misc.Wheel.A:FindFirstChild("NewWeld")
        local Weld2 = car.Misc.Wheel.A:FindFirstChild("NewWeld2")

        if Weld ~= nil then
            Weld:Destroy()
        end
        if Weld2~= nil then
            Weld2:Destroy()
        end 
        end
    end)
    car.DriveSeat.ChildAdded:connect(function(child)
        character["LeftHand"].Transparency = 0
        character["RightHand"].Transparency = 0
                local W = Instance.new("Weld")
                W.Part0 = RightArm
                W.Part1 = car.Misc.Wheel.A

                local CJ = CFrame.new(car.Misc.Wheel.A.Position)
                local C0 = RightArm.CFrame:inverse()*CJ
                local C1 = car.Misc.Wheel.A.CFrame:inverse()*CJ

                W.C0 = C0
                W.C1 = C1
                W.Parent = RightArm

                local Y = Instance.new("Weld")

                Y.Name = "NewWeld"
                Y.Part0 = car.Misc.Wheel.A
                Y.Part1 = RightArm
                Y.C0 = CFrame.new(0.2,-0.9,-2.5) * CFrame.fromEulerAnglesXYZ(-0.01, 1.5, -1.8)
                Y.Parent = Y.Part0
                ------------------------------------------------

                local W = Instance.new("Weld")

                W.Part0 = LeftArm
                W.Part1 = car.Misc.Wheel.A

                local CJ = CFrame.new(car.Misc.Wheel.A.Position)
                local C0 = LeftArm.CFrame:inverse()*CJ
                local C1 = car.Misc.Wheel.A.CFrame:inverse()*CJ

                W.C0 = C0
                W.C1 = C1
                W.Parent = RightArm

                local Y = Instance.new("Weld")

                Y.Name = "NewWeld2"
                Y.Part0 = car.Misc.Wheel.A
                Y.Part1 = LeftArm
                Y.C0 = CFrame.new(-0.2,0.9,-2.6) * CFrame.fromEulerAnglesXYZ(0.93, 1.8, -2.2)
                Y.Parent = Y.Part0
    end)
Ad

Answer this question