So the my dotproduct keeps printing ‘‘me see’’ meaning as it sees the object, however it keeps seing the object even if the object is in inappropriate angle, how can i fix this?
script border
while wait(0.001) do
wait(0.1)
local PathfindingService = game:GetService("PathfindingService")
local TweenService = game:GetService("TweenService")
-- Variables for the car and destination, etc.
local carprimary = script.Parent
local path = PathfindingService:CreatePath()
path:ComputeAsync(carprimary.Position, workspace.Location.Position)
local waypoints = path:GetWaypoints()
for _, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Name = "Pathfind_Point"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = waypoint.Position
part.Anchored = true
part.CanCollide = false
part.Parent = game.Workspace
local LocationFinder = script.Parent.Middle2.CFrame.LookVector
local LocationFinder_Location = (script.Parent.Middle2.Position - workspace.Location.Position).Unit
local dot = LocationFinder_Location:Dot(LocationFinder)
if dot < 0.5 then
print('me see')
else
print('nah no see')
end
--carprimary:MoveTo(waypoint.Position)
wait(0.1)
end
wait(0.001)
end
script border