i want to create a system to apply blood decals to bodyparts after they get attacked but i dont really know how lol
3 Likes
if you can get the normal of the hit point then you can get the face of that part using this function
function GetNormalFromFace(part, normalId)
return part.CFrame:VectorToWorldSpace(Vector3.FromNormalId(normalId))
end
function NormalToFace(normalVector, part)
local TOLERANCE_VALUE = 1 - 0.001
local allFaceNormalIds = {
Enum.NormalId.Front,
Enum.NormalId.Back,
Enum.NormalId.Bottom,
Enum.NormalId.Top,
Enum.NormalId.Left,
Enum.NormalId.Right
}
for _, normalId in pairs( allFaceNormalIds ) do
-- If the two vectors are almost parallel,
if GetNormalFromFace(part, normalId):Dot(normalVector) > TOLERANCE_VALUE then
return normalId -- We found it!
end
end
return nil -- None found within tolerance.
end
1 Like