Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I detect if the player camera is looking up?

Asked by 3 years ago

I'm scripting something dont want to talk a lot I'm gonna keep it simple so I want to print Camera is looking up if it is.

here is what I got

local camera = workspace.CurrentCamera
while wait(1) do
    if camera.CFrame.UpVector then
        print("Camera is looking up")
    end
end

1 answer

Log in to vote
1
Answered by 3 years ago

I'm not too sure about this but you can use the dot product

--quicc mafs
function UpOrDown(LookVector)
    local LookVector = LookVector.Unit
    local UpVector = Vector3.new(0, 1, 0)

    --Should return a value within range [-1, 1]
    return LookVector:Dot(UpVector)
end
0
hey I've seen this code somewhere else so can you please explain it Xx0966xX 41 — 3y
Ad

Answer this question