Given that context, how would I go about programming something like this? Is there any neat tricks to easily avoid intersections?
My first idea would be to shoot a raycast from point A (red dot) and see if it hits anything. If the raycast detects that the blue dot was hit, then immediately draw a straight line as that suggests no intersecting parts exist. However, if something else was hit, do something that would well, avoid said hit thing.
I honestly have no idea how to approach this problem so any help would be greatly appreciated.
Check this out, I got it from Roblox’s pathfinding documentation:
local TEST_DESTINATION = Vector3.new(100, 0, 100)
local waypoints
local nextWaypointIndex
local reachedConnection
local blockedConnection
local function followPath(destination)
-- Compute the path
local success, errorMessage = pcall(function()
path:ComputeAsync(character.PrimaryPart.Position, destination)
end)
if success and path.Status == Enum.PathStatus.Success then
-- Get the path waypoints
waypoints = path:GetWaypoints()
-- Detect if path becomes blocked
blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
-- Check if the obstacle is further down the path
if blockedWaypointIndex >= nextWaypointIndex then
-- Stop detecting path blockage until path is re-computed
blockedConnection:Disconnect()
-- Call function to re-compute new path
followPath(destination)
end
end)
So they compute a path and if that path gets blocked they compute again and so on to get all desired waypoints in place and use those waypoints to create parts, that’s just some of the code you may want to check the rest at Character Pathfinding | Documentation - Roblox Creator Hub
I like the method you mentioned, but at the moment I lack the skill required to build my own reliable path finding system for ropes. I’ll be heading to sleep now; I’ll look back at this thread to see if anybody has another suggestion.