I really wan to make a obstacle avoidance system but I don’t know how to go about doing it, I don’t mean as in a very high tec one a mean it raycasts from the part and if it finds a wall then it will turn to avoid it.
The blue arrows are raycasts the trouble I am having is how to go about decide if the part should go left or right 1 or -1, I know a little about Dot and Cross vectors and a fear deciding which way to go will involve it.
My idea is you would use the normal vector of the surface the raycast hits, and then use the orthogonal vector of the normal vector of the surface and the unit up vector to direct the object. It looks something like this:
Since you only want the object to go left or right, you can take the cross product of the unit up vector and the normal vector of the surface. Then, you make the object smoothly transition to the vector d (the direction vector). Repeat this until the object does not find a surface in front of it.
I made something for this awhile ago (though using a full blown pathfinder for something like this might be slightly overkill)
Pathfinding.rbxl (27.1 KB)
it’s incredibly incompetently made and gets comically laggy if you make it calculate too much especially so if the target destination is moved around in runtime, but if you’re just pathfinding your part around static parts in a semi-linear environment it should works fine