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

HumanoidRootPart Anchor/Unanchored movement issues?

Asked by 5 years ago
Edited 5 years ago

Hello,

I am currently working on a wall climbing mechanic and to do it I have to anchor the HumanoidRootPart of the player. Then depending on the players input move the RootParts CFrame accordingly. At the end of the climb the HumanoidRootPart is unanchored.

All of that works properly; however, after the climbing is finished the Character starts to behave strangely. When the player is close to anything their speed changes, varying from speeding up to slowing down.

Any thoughts on why this may be?

Here is the code for starting the climb: *Edit: I rewrote my own movement script for this project and Anchoring/Unanchoring the HumanoidRootPart seems to mess up the Humanoid:Move() function

if Hold_Shift and not crouched and not finishing and not climbing then
    local forwardRay = RAY(rootPartPosition, rootPartLookVector*rootPart.Size.Z*2)

    local part, hitPosition = workspace:FindPartOnRayWithWhitelist(forwardRay, ClimbList, true)

    if part then
        rootPart.Anchored=true
        local Z = (rootPartPosition-VECTOR3(hitPosition.X, rootPartPosition.Y, hitPosition.Z)).magnitude

        rootPart.CFrame = CFRAME(rootPartPosition, VECTOR3(hitPosition.X,rootPartPosition.Y,hitPosition.Z) - normal)*CFRAME(0,0,-(Z-0.85))

        climbing=true
    end
end

Here is the code for ending the climb:

if h.Jump and climbing then
    climbing=false
    rootPart.Anchored=false
    JumpAnim:Play()
    finishing=false
    rootPart.Velocity = (-rootPartLookVector+VECTOR3(0,1,0))*h.JumpPower
end
0
probably has to do something with the rootpart's velocity hellmatic 1523 — 5y
0
Tried resetting velocity before, after, and both before/after back to zero and still got the same results. curtisornot 0 — 5y
0
How is the second portion fired? By a event function, a loop? hellmatic 1523 — 5y
0
Loop, and it only fires once when activated and then turns off until the next time I activate it curtisornot 0 — 5y

Answer this question