Hello everyone!
Im trying to make use of the :Dot() function, but it doesn’t seem to be working properly. From my understanding, dot is intended to give you a value between -1 and 1 to show how closely two vector are facing in the same direction. Unfortunately, my attempts at using it have resulted in numbers upwards of 40,000+ depending on the distance between the two points.
Here is my code:
local root = script.Parent.Parent:WaitForChild("HumanoidRootPart")
local enemyModel = workspace:WaitForChild("Entities"):WaitForChild("Dummy")
game:GetService("UserInputService").InputBegan:Connect(function(obj,gameProcess)
if obj.KeyCode == Enum.KeyCode.R then
local dot = root.Position:Dot(enemyModel.HumanoidRootPart.Position)
print(dot)
end
end)
My goal with using Dot Products is to make a system that can tell if a player is in front of another player or not.