#Radial Action Billboard Gui Based On 3D World Mouse Position

1 messages · Page 1 of 1 (latest)

spice furnace
#
Mouse.Move:Connect(function()
    local screenPos = Camera:WorldToViewportPoint(PlotBillboard.Adornee.Position)
    local dx = Mouse.X - screenPos.X
    local dy = Mouse.Y - screenPos.Y

    local angle = math.atan2(dy, dx)
    local degrees = math.deg(angle)

    Pointer.Rotation = degrees - 90
end)

so i want the pointer to rotate based on the 3d world position of the mouse and not by the screen. Anyone got any idea?

spice furnace
#

but the issue is still there

steep oxide
#

i'll need to set up a test for this

steep oxide
# spice furnace ```lua Mouse.Move:Connect(function() local screenPos = Camera:WorldToViewpor...

i can say with absolute certainty your math is fine (though i did have to negate dx and dy), the problem is the gui is not centered

local LocalPlayer=game.Players.LocalPlayer
local Mouse=LocalPlayer:GetMouse()
local Camera=workspace.CurrentCamera
local frame=script.Parent
local guiRoot=script:FindFirstAncestorOfClass("BillboardGui")

Mouse.Move:Connect(function()
    local adornee=guiRoot.Adornee
    if not adornee then return end
    
    local screenPos = Camera:WorldToScreenPoint(adornee.Position)
    local dx = screenPos.X-Mouse.X
    local dy = screenPos.Y-Mouse.Y

    local angle = math.atan2(dy, dx)
    local degrees = math.deg(angle)

    frame.Rotation = degrees - 45
end)```
spice furnace
#

hmm

#

I mean

#

it is centered

#

Lemme see

spice furnace
#

Mine is kinda flat, on the ground

#

I think i can fix it

#

if i have a cube floating on top of the plot

#

which can be used as the adornee

#

yeah lemme try that

#

that should work

spice furnace