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.
