Raycast failing to hit an object with clear view

Currently using Raycast to make sure that an appearing bridge doesn’t go through an island on its way to its destination.

When firing to the destination point 99% of the time it misses and returns nil.

local ray = workspace:Raycast(p.Position, (o.Parent.Main.Position - p.Position).Unit * (o.Parent.Main.Position - p.Position).Magnitude,pr)

Point representations for below

o.Parent.Main.Position – 2
p.Position – 1


White represents where the ray may be shooting for some reason, and red indicates where it should be shooting.

I am a little tired right now since it’s 3 am, so forgive me if I managed to make a stupid mistake.

Thank you

1 Like

Why are you multiplying? I don’t understand shouldn’t it be just destination position - start position

Multiplying is there for raycast range.

1 Like

Removing that seemed to fix it once I implemented an external version of range, thank you!

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