[Help] Wall Collision

Hey guys,

I’m currently using a rudimentary LOS system to detect a wall on any side of the player regardless of player position or map. Basically if a point 1.5m away from the eye position of the player in the cardinal directions is blocked from seeing the player, it returns that the player is “touching” a wall. This method works, however it honestly does not feel like the best solution.

I figure that a raycast hit could work in the direction of the velocity of the player, however since players have gravitational decay on their trajectory it isn’t the most accurate method. Since the player does not always contact that position, I’m not sure how to measure distance. Increasing the radius of detection (for example using players within radius) increases the radius of detection in a sphere, when I would like to only detect when they hit a wall.

I was wondering if there was any way to use raycasts or a simpler condition to check if the player is touching a wall independent of map or coordinates. Preferably this method would be accurate to 1m of where the player touches the wall and wouldn’t use LoS pseudo detection because of the server slowdown.

Thanks!

Code with basically what I am using now to detect as a condition (don’t yell at me it’s way too long I know): AA9FJ

Not that I know of. You could however multiply the player velocity by (1, 0, 1) to remove the gravity component when casting your ray.

Note though that the ray cast doesn’t hit invisible collision, only visible static surfaces.

Decided to only cast the normal if they are close to the wall position already, kinda decreases load but still not that well. Thanks for the help!