(THIS HAS BEEN REDACTED FOR MY PRIVACY, AND WHATNOT. Please, carry on!)
:3
(THIS HAS BEEN REDACTED FOR MY PRIVACY, AND WHATNOT. Please, carry on!)
:3
If that’s your goal you have to mess around with camera cframe and create a function that updates your viewport frame everytime you make a camera rotation
local players = game:GetService("Players")
local runService = game:GetService("RunService")
local currentCam = workspace.CurrentCamera
local mainPart = workspace:WaitForChild("GOOBER")
local attachment = mainPart:WaitForChild("img_Att")
local billboard = attachment:FindFirstChildWhichIsA("BillboardGui")
local imageLabel = billboard:WaitForChild("img")
local rotations = {0, 45, 90, 135, 180, 225, 270, 315}
local images = {
[0] = "rbxassetid://11104447788",
[45] = "rbxassetid://12936162825",
[90] = "rbxassetid://12236696313",
[135] = "rbxassetid://13370612666",
[180] = "rbxassetid://16014360744",
[225] = "rbxassetid://7266774615",
[270] = "rbxassetid://10047977817",
[315] = "rbxassetid://1380194908"
}
local function normalize(angle)
angle = angle % 360
return angle < 0 and angle + 360 or angle
end
local function getClosestRotation(angle)
local closestRotation
local minDifference = math.huge
for _, rotation in ipairs(rotations) do
local difference = math.abs(normalize(rotation) - angle)
if difference < minDifference then
minDifference = difference
closestRotation = rotation
end
end
return closestRotation
end
runService.RenderStepped:Connect(function()
local camRight = currentCam.CFrame.RightVector
local mainPartOrientation = -(mainPart.CFrame.RightVector)
local angle = math.deg(math.acos(camRight:Dot(mainPartOrientation)))
if camRight:Cross(mainPartOrientation).Y < 0 then
angle = 360 - angle
end
angle = normalize(angle)
local closestRotation = getClosestRotation(angle)
imageLabel.Image = images[closestRotation]
end)