So I've been working on a custom climbing module on and off for a while now, but I am still stuck on a fairly large problem. You can test climbing right now on either your keyboard or gamepad here: http://www.roblox.com/games/303866922/StarterScripts-rework But you may encounter a bug that allows the player to climb further vertically than they should be able to
Using this code:
CPos=CPos*CFrame.new(MoveVal.X/15,-MoveVal.Z/15,0) local YMax = Part.CFrame.Y+(Part.Size.Y/2) local YMin = Part.CFrame.Y-(Part.Size.Y/2) local XMax = Part.CFrame.X+(Part.Size.X/2) local XMin = Part.CFrame.X-(Part.Size.X/2) local TestFrame = Part.CFrame:toObjectSpace(CPos) if TestFrame.X<XMin or TestFrame.Y<YMin or TestFrame.X>XMax or TestFrame.Y>YMax then return "Fail" end
I hoped to be able to find if the player has moved their Root's CFrame to outside of the surface of a ladder piece. I do this by calculating the piece's point of origin, and then adding/subtracting half its size, as seen by ymax,ymin,xmax,xmin. However, I believe I have miscalculated something. While the Player remains within the X bounds, they are never within the Y, despite visually being within acceptable bounds.
Can anyone throw some light onto what I've done wrong here? I've been trying to post on the forums, but I keep getting an error.
tl;dr: Working on a climbing module that lets you climb on moving ladders and 360 degrees, current calculations mess it up and allow players to climb outside the ladders.
This is going to be made free to use once I can get it all working, so if you would like the rest of the code to reference just let me know.