#Sort of complex ui issue

1 messages · Page 1 of 1 (latest)

opaque berry
#

So im working on a blood engine, rn im working on blood on walls. Im doing this with a surface gui to ensure that blood gets cutoff correctly if a blod splat lets say hits at the edge of a wall. Just like in the picture. My current script is performing the calculations somewhat correctly, but due to the rotation of the part the surface gui is a children of, it is not where it should be (see the video for reference). If anyone happens to know a fix for this issue or knows a better alternative for rendering blood i would very much like to know.

Here is my current code:

local StudsToOffset = function(number : number) : number
    return number * 50
end

local Utils = {}

function Utils.GetOffsetFromParts(hit : Instance,part : Instance) : UDim2
    if hit:IsA("BasePart") and part:IsA("BasePart") then
        local offset = part.CFrame:PointToObjectSpace(hit.Position)
        local X = offset.X
        local Z = offset.Z
        return UDim2.new(0,StudsToOffset((part.Size.X / 2) + X), 0, StudsToOffset((part.Size.Z/ 2) + Z))
    end
end

local result = Utils.GetOffsetFromParts(workspace.hit,workspace.SpawnLocation)

print(result)
workspace.SpawnLocation.SurfaceGui.Frame.Position = result

return Utils

If you really read all that im glad, and im sorry for yapping like that.

#

the white frame is supposed to be at the neon red part at the start but it isnt :/

opaque berry
#

me when no one helps

marsh crane
#

i hate cframe but im guessing you would have to account for rotation somehow (obviously)

#

probably by multiplying the result by the parts rotation

opaque berry
#

ive decided to scrap the surface gui idea, i got another idea that is prob less optimized but if done right should give better results

random flame
opaque berry
opaque berry
#

yo guys, you guys know a way to change absolute rotation inside of a surface gui

#

cus i just found out the surface gui works but it is just of by 90 degrees