Making blood stick to a surface correctly

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I wanna make blood stick to a surface when the little droplets hits something

  2. What is the issue? Include screenshots / videos if possible!
    They don’t orientate with the surface, but to the orientation of the part
    https://gyazo.com/9977bf903ebd2048b74f3bc1feb09f24

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

  • CFrame.lookat
    I’m not going to do raycasting unless it’s my only solution

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Blood Splatter Script

blood.Touched:Connect(function(hit)
	local bloodsplatter = game.ReplicatedStorage.BloodSplatter:Clone()
	bloodsplatter.Parent = workspace
	bloodsplatter.Position = blood.Position + Vector3.new(0,.1,0)
	bloodsplatter.Orientation = hit.Orientation
end)

Try using raycast:

local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {blood} -- filter so the ray ignores the blood descendants
rayParams.FilterType = Enum.RaycastFilterType.Exclude

local c c = game["Run Service"].Heartbeat:Connect(function()
	local results = workspace:Raycast(blood.Position, Vector3.new(0,-1,0), rayParams)
	-- checks if the ray hits anything
	if not results then return end
	-- hit then disconnect so it doesn't clone blood splatter indefinatly
	c:Disconnect()
	
	local bloodsplatter = game.ReplicatedStorage.BloodSplatter:Clone()
	bloodsplatter.CFrame = CFrame.lookAt(results.Position, results.Position + results.Normal) * CFrame.Angles(math.rad(-90),0,0)
	bloodsplatter.Parent = workspace
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.