#Hey! Can someone help me with displaying ui element based on worldspace position?

1 messages · Page 1 of 1 (latest)

south solar
#

I tried using both worldtoscreenspace and worldtowiewport things but I havent had much success.

local function Explode( _wp , dt )
    timer += dt
    local _frame = math.round( fps * timer ) + 1
    local _pos = { ((_frame - 1)%size[1]), math.floor( ( (_frame - 1)/size[1] ) ) }
    Image.Position = UDim2.new( _pos[1], 0, _pos[2], 0 )
    local _wtsp = Camera:WorldToViewportPoint( _wp ) -- And here
    Frame.Position = UDim2.new( _wtsp.X, 0, _wtsp.Y, 0 ) --Here
    if _frame == totalFrames then
        state = 0
        timer = 0
        Image.Visible = false
    end
end

Yes i know its a mess I wanna get it working before I actually start refactoring and making it usably pretty.
But when I try to use either the absolute position absolutely skyrockets.

#

And Camera is workspace.CurrentCamera

kindred tiger
south solar
#

So I tought I'd be cool to yk... Do it.

kindred tiger
#

so the explosion is 2d, is it a 2d game?

south solar
kindred tiger
south solar
south solar
#

Tys,

#

*Tysm