#Eye tracking is offset by 90 degrees?

1 messages · Page 1 of 1 (latest)

crude talon
#

I am attempting to get this cupcake to look at me wherever I go. I have the eyes in a model, so that they can pivot on the Y axis with the head, and then I have the script adjust the XZ axis of each eye individually. This is because I plan to slow down the tracking of the head of the cupcake so that the eyes will look at the player while the cupcakes head tries to keep up, making it look a bit more realistic.

#

This script is managing multiple head trackings, so dont mind.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local pHead = character:WaitForChild("Head")

----------- MAIN LOOP -------------

game:GetService("RunService").RenderStepped:Connect(function()
    local targetPos = pHead.Position

    -- SHADOW FREDDY --

    local shadowFreddy = workspace.Map.Map:WaitForChild("shadowFreddyPAS")

    local sFHead = shadowFreddy.up:WaitForChild("head")
    local sFHeadPivot = sFHead:GetPivot()
    local sFHeadPos = sFHeadPivot.Position
    local sFFollow = CFrame.lookAt(sFHeadPos, targetPos, Vector3.new(0,1,0))
    sFHead:PivotTo(sFFollow)

    -- GIANT CUPCAKE --
    
    --Head--
    local cupcake = workspace.Map.Map:WaitForChild("giantCupcake")
    
    local gCHead = cupcake:WaitForChild("Head")
    local gCHeadPivot = gCHead:GetPivot()
    local gCHeadPos = gCHeadPivot.Position
    local targetY = Vector3.new(targetPos.X, gCHeadPos.Y, targetPos.Z)
    local gCFollow = CFrame.lookAt(gCHeadPos, targetY, Vector3.new(0,1,0))
    gCHead:PivotTo(gCFollow)
    
    --Eyes--
    local gCEyes = cupcake.Head:WaitForChild("Eyes")
    local gCEyePivot = gCEyes:GetPivot()
    local gCEyePos = gCEyePivot.Position
    local EyetargetY = Vector3.new(targetPos.X, gCHeadPos.Y, targetPos.Z)
    gCEyes:PivotTo(gCFollow)
    for _, eye in ipairs(gCEyes:GetChildren()) do
        if eye.Name ~= "PrimaryEyes" then
            local eyePos = eye.Position
            local eyeTargetXZ = Vector3.new(targetPos.X, gCEyePos.Y, targetPos.Z)
            local eyeFollow = CFrame.lookAt(eyePos, eyeTargetXZ, Vector3.new(0,1,0))
            eye.CFrame = eyeFollow
        end
    end
end)
vivid basin
obtuse dustBOT
#

studio** You are now Level 8! **studio

vivid basin
#

its js a cframe.new(eyeposition,playerposition)

heady spoke
crude talon
#

geeked in the clouds

crude talon
fading epoch
vivid basin
#

It should just be a loop and one line basically

#

Or two cause of two eyes

#

Is the decal just on the wrong face or something

#

Wym by 90 offset

crude talon
fading epoch
#

make it so that the pupil matches where the front of the part is

crude talon
fading epoch
#

hmm

fading epoch
crude talon
fading epoch
#

nice, does it work now?

crude talon
#

yeah, but im not sure how to achieve that delayed head movement

fading epoch
#

you can lerp it prob

#

or tween

crude talon
#

ohhh ok