Hello, I am currently trying to make a wallrun system but I have encountered a problem. I find difficulty in actually activating wallrunning as the raycast is very hard to activate.
With the raycast, all I am currently doing is raycasting to the rightvector of the humanoid rootpart but it seems that it makes it more difficult to wallrun.
My current code for the raycast is:
local wallRight = workspace:Raycast(HRP.CFrame.Position, HRP.CFrame.RightVector * RayDistance, raycastParams)
I use the old raycast for “.Instance” as I had to detect if the wall had a value in it giving the ability to wallrun on the specific wall.
if wallRight.Instance:FindFirstChild("Wallrun") then
I also have to check if the wall is right or left because of a tilt camera feature and animation.
Well, my solution would be to raycast to the sides of the humanoidrootpart. If it hits something on the right side, position the hrp against the wall, anchor & tween it so it moves down the wall and make an animation play.
I tried it but it made the movement still very hard and the raycasting was also very hard to be detected because of the size which just kept confusing me.
Then I think something went wrong with your raycast calculation.
-- example of casting to the right of a certain character part, could also be the humanoidrootpart if you want
local ray = workspace:Raycast(origin.Position, (origin.CFrame.RightVector - origin) * studs, rayparams)