Streamlining Diving Mechanics

I’ve been working on this diving system for a platformer. Right now it has collision detection that scans 4.5 studs directly in-front of the HumanoidRootPart for a collision, shown here:

However, people can skim across walls by lining up parallel with a wall, then angling their body slightly towards it. The result is as follows:

Does anyone have any proposed solutions that I could try and implement to keep this from happening? Thanks!

2 Likes

You could try shooting 2 more rays forward from the left and right of the character to check if those hit, as shown here.


Make sure you don’t base it on the arms, and instead offset from the HumanoidRootPart. Otherwise, the rays will incorrectly hit the ceiling, ground, etc. because of how the arms swing.

You may also want to try rays at an angle, perhaps 20 degrees left/right, from the root part, as the arms may be inside the object you’re trying to detect.

1 Like

I actually just thought of that right after I posted this. I’ll give it a shot tomorrow and mark this as solution if it works! :wink:

1 Like

This worked!

However, I opted for casting 4/5ths of the way to each left/right face on the torso, so approx. 0.8 studs away from the HumanoidRootPart in either direction, therefore allowing people to dive exactly parallel to walls with an arm inside of it (just because players’ arms don’t have collisions).

Thanks!

1 Like