How to detect wall collision

i’m using a bodyvelocity for my slide system, and whenever i slide into a wall the player jitters like this:

i’ve disabled tripping and ragdoll states for the humanoid, and i’ve tried to detect rootpart velocity every heartbeat but none of those worked

i’m thinking of detecting when the player slides into a wall and then break the slide, but i’m not sure how exactly to do that

2 Likes

Use “Touched” event and when player touched to part destroy bodyvelocity and stop animation. Also you can use raycast for it. When player is sliding, raycast through part. If part Y size is more than player’s size or any body part then remove bodyvelocity and stop animation.

Use Raycasting.
Before sliding, fire a ray in front of the character (HumanoidRootPart.CFrame.LookVector.Unit * lenghtOfRay or distanceCoveredBySlideInStuds) and check if it returns a result. If the result is nil, then proceed with slide, otherwise do nothing. :slight_smile:

I would also suggest switching BodyVelocity with a VectorVelocity or LinearVelocity because BodyVelocity has been deprecated. Changing it to a more modern constraint may also fix the issue.

1 Like

works fine enough, thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.