I have a problem with bullet holes and blood in my FPS game. Everything works fine, but sometimes these parts stick out and I don’t want that.
Ray is created in the specific direction and if hits then creates a wedge (blood or bullet hole).
This is what I need:
I know it’s possible since I’ve seen it already in different games, also tried searching the internet but I don’t know what to search.
I have some ideas like to clone the part that the ray hits and union it so it cuts of the sticking part, but this would slow down the game and don’t know how to do it.
1 Like
You can achieve this with a Surface GUI, and it automatically clips the image.It’s a bit harder to place it correctly on the part.
Structure can be like this:
|Surface Gui
|-> Frame
|-> ImageLabel
See for more: Tips and Tricks On Getting Realistic Bullet Hole And Blood Decals?
1 Like
Do you have any idea how would I offset it to the right place since it’s a decal and I used a CFrame?
It’s not an easy task, but I can try to summarize:
*Casting a ray to detect the surface.
*Finding the face of the part using the ‘normal’ returned from raycast.Normal.
(We need the ‘part face’ to align the surface GUI face correctly.)
*Finding the local position on the part using raycast result.Position.
-- Maybe something like this. I didn't try it.
rayResult.Instance.CFrame:toObjectSpace(CFrame.new(rayResult.Position))
Ps: You shouldn’t use a decal. I think it will not work in a Surface GUI.
1 Like
What else should I use instead of decal?