The CFrame mostly works for parts that are higher up, I’m guessing this is because it has more time to find the position, but right now I need a way to accurately calculate a ledge each time.
Assuming you just need to modify the Y axis to get to the appropriate ledge position, could you just read the hit instance’s position and offset it by its size?
local function getLedgeHeight(raycastPart)
local pos, size = raycastPart.Position, raycastPart.Size
return pos.Y + (size.Y / 2) --//adding additional offset as needed.
end
Hello, I am currently working on my own game and I wanted to implment wall climbing.
I had never made an extensive system but I have finally gotten it to work after hours!
Alright so basically a first I had just made it so that id check if a player was close to either the front, back, left, or right side of the part and then getting the position of the player relative to the position of the part. That worked but when i got to the corners it would snap a way I just didnt like.
Anyways, I just tried raycasting and then getting the relative position of the player to part and it works FLAWLESSLY! Any size part, any rotation it might have!
The blue parts are just visualizer for the relative positioning for the player to the part
I use these values to clamp the position so it doesnt go outside of the parts size boundary! And this is also where I get th relative position of the player to the part’s cframe
Yeah, that works but it only works on parts that have a size with the same 3 values, for the front its fine but for the sides of the disproportional part are inaccurate cm devlog - Roblox Studio (gyazo.com)
Hm it seems your goin to have to change some of the math inside of where you assign the positoning, in my game there the same on the x and z so i dont have that problem