New to raycasting

hi im new to raycasting, and i wanted to know how to make collision systems like box colliders but ive been using parts to make them, so i wanted to know how to make player collisions like custom character controller using raycast but i dont know how to exactly make the collisions out of raycasting so maybe making a post about it would help, so any advice or guidance would be greatly appreciated. If you could share any tips, solutions, it would be extremely helpful. Thank you!

1 Like

Roblox’s built-in collisions will always run better than anything you make, however, since Roblox uses discrete collisions, where it only checks the next position based on velocity and friction, you can improve it with raycasts. If you get the object’s velocity (direction and speed) and friction, you can fire a raycast from the current position of the object to its estimated next location and if you hit a part, move the part there (+ move it back so it’s not within the hit) on the next physics step and reverse the direction (with some dampening). If you do this every physics step, you’ll make the game use continuous physics instead of discrete so it makes sure the entire path to the next destination is valid instead of just the next destination. Do note that this is can get very taxing so only use it on things that NEED high quality collisions at high speed.
You can look up discrete vs continuous collision on Google for more information.

1 Like

I’ve made a new post about it, just basically wondering on how to make a better approach on collision response