How Do I make a Part not inside Other Part from Raycast

I use raycasts for a blood system, and the bloods Y size is 0.001. The problem is that it goes 0.001 (Axis.Y/2 (Impossible in this case) ) Studs in the ground, inside of my raycasting system, how can I make the raycast go 0.001 studs “up” but still depending on the direction?

I know I could use Position+vector3.new(0,0.001,0), but that would result in it only working in the Y level. The reason I want this fixed is because blood clips through the ground since the PBR Mesh for the blood is at a very slight angle.


very inconvenient

at position vs at position + position that makes it go forward so it’s not going through the ground

Just make the blood Part .004 studs thick. That way it should be .002 studs above the surface.
The other alternative is to use the Part’s CFrame, not the World CFrame.

Make the CFrame face the normal of the raycast.

Code:

part.CFrame = CFrame.lookAlong(raycast.Hit.Position, raycast.Normal)
1 Like

You can use this

local raycast = workspace:Raycast(parthere,direction,params)

local castCF = CFrame.new(raycast.Position,raycast.Position + raycast.Normal)
part.CFrame = castCF + CFrame.new(0,0,0) --edit this to get the specific direction
1 Like

And Roblox CFraming will actually calculate to finer decimals than .001. It only shows .001 in Studio.

You can see this if you zoom in right to a Parts edge and type in an x, y or z values like (for example) 42.005 then try 42.0045, then try 42.0054. The value will read 42.005, but you can see the Part edge move very slightly.

the blood still splitted
image

I already done it like this:

	b.CFrame = CFrame.new(Position,Normal)* CFrame.Angles(math.rad(90), math.rad(math.random(-180,180)), 0)

it dint dnt work

Can you try to use my code?

Sorry for a late response

I misread it as Cframe lookat, but when I use the code you present it still split

image

I also had to add this to the code after:

CFrame.lookAlong(Position, Normal)* CFrame.Angles(math.rad(-90), math.rad(math.random(-180,180)), 0)

for realistic blood and its facing the right way

Try increasing the thickness by about .002 studs each time to see if it still splits.

Decals drawn right at the surface of other Parts will start to get covered up as you move the camera further away.
Even if you increase it so the splatter sits .01 studs above the surface I doubt anyone will even notice it during gameplay.

it still split (sorry a late responers)

image

I need way to make raycast part go on the position and not in the position because the mesh will always be inside no matter how high it thick because is shaped like this:

No color

Making it thicker would just result in a higher slant

Why are you using a WedgePart?
If you are then that’s your issue. It should be on a regular Part.

its a meshpart that i didnt create but i wanna the blood to be realistic

I’d recommend finding another blood image and just make it into a Decal (or find one from the toolbox).

The other way would be to resize it back to .001 and CFrame it up higher about .005 studs up from the surface like @Katrist or @Laqotaa said.

If I made CFrame up by 0.005, would the CFrame be dependent on the bloods axis?

Can you try to make the mesh a flat plane? You can also try to get a decal and put it on a flat part.

Idk how to make the flat plane mesh a flat plane to mesh and if i put decal on a part then it wont look ultra realistic

Try it and see what happens.
Just keep the MeshPart thickness .001 to get rid of as much of the wedge angle as possible.