So what im trying to do is a eye that catches the player movement and makes what we call the eye-tracking
The problem so far is that I can’t do the right calculus to reach into this type of tracking and Im on wonder if ya’ll could help me
So far what I’ve tryed… Not really that much on searching (Because when I tryed I kinda dint find anything) but by myself i’ve been trying do to alot of different tests to see if i could reach into it
Here is some of the script i’ve been doing.
local RunService = game:GetService("RunService")
local Npc = script.Parent
local HumanoidRootPart = Npc:WaitForChild("HumanoidRootPart")
local Face = Npc:WaitForChild("Face")
local WhiteEye = Face:WaitForChild("WhiteEye")
local LeftOcular = WhiteEye:WaitForChild("LeftEye")
local LFkOcular = WhiteEye:WaitForChild("LFakeEye")
local NpcToCharacter
local Radius = 1
local OldOrientation
local OldPlrPosition
local OldPosition
local lookVector
local CurrentSubject
local DetectorName = "PlayerDetector"
local random = Random.new()
RunService.Heartbeat:Connect(function()
print(CurrentSubject)
if CurrentSubject then
OldOrientation = LeftOcular.Orientation
NpcToCharacter = (LeftOcular.Position - CurrentSubject:WaitForChild("Head").Position).Unit
local NpcLook = Face.CFrame.LookVector
print(NpcToCharacter)
local DotProduct = NpcToCharacter:Dot(NpcLook)
print(DotProduct)
-- try to maintain eye contact with the player without having to move the line that makes it
-- Use the Scale that's the opposite of it to move ?
if DotProduct <= Radius and OldPlrPosition ~= DotProduct then
OldPlrPosition = DotProduct
if NpcToCharacter.X == DotProduct then
LeftOcular.Position = Vector3.new(LFkOcular.Position.X, LeftOcular.Position.Y, LFkOcular.Position.Z + DotProduct / 2)
elseif NpcToCharacter.Z == DotProduct then
LeftOcular.Position = Vector3.new(LeftOcular.Position.Y, LeftOcular.Position.Y, LFkOcular.Position.X + DotProduct)
else
LeftOcular.Position = Vector3.new(LeftOcular.Position.Y, LFkOcular.Position.X + DotProduct, LeftOcular.Position.Z)
end
LeftOcular.Orientation = OldOrientation
end
end
end)
What I ask is just if there’s a theory that could help me or some type of Math Formula that could help me getting into it atleast
And It’s okay if you can’t help, the intention is the one that matters!