Floating decals when a wall is shot with a projectile-based weapon

Hello, everyone!

I’ve been trying to fix this for a while now, but I’ve been unable to figure it out. I believe it has to do with sending the position of the projecitle to the server to create the decal, since doing it with mouse.hit.p, fixes the floating decal problem, but only puts decals where the mouse is pointing, which is very, very bad.

Images:
Floating decal example:


image

Example with correct decal adhesion, but these decals go to wherever the mouse is pointing, instead of where the projectile hits:

Code snippet:

--Fired upon the projectile reaching it's destination. The projectile is raycasted.	
local position = Missile.Position

game.ReplicatedStorage.UnicornEngine.Events.DecalProcessor.ProcessDecal:FireServer(cf, hit, position, norm,minSize,maxSize, texture, hit,decalType,impactColor,lightColor, isLocal)

I’m wondering if there’s any way to fix this, perhaps combining both into one someway so the decal adheres to a surface correctly.

Thanks!

I’m not a scripter, but maybe make it so the mouse is locked in the center? Sorry if this comment was useless, just something I was thinking while reading, But anyways, hope you find a solution! :grin:

1 Like

The mouse is locked to the center.

With the current method, the decal will land wherever the projectile hits, but it has a tendency to float 1-3 studs from a surface.

1 Like

I count 12 variables in your example snippet that have a nil value. You’ll probably have to fix those, first.

Sarcasm aside, we give any advice with the info you gave us. You have to provide more code.

1 Like

I explained that it works fine with mouse.hit.p, rather than Projectile.Position. Problem with mouse.hit.p is it goes directly to where the mouse is pointing. But mouse.hit.p adheres to the surface correctly, so I’m not sure what to do tbh.

I need a way to combine both of them.

When the projectile is touched, try raycasting directly forward and use that hitPosition?

2 Likes

This solved my issue!

Thank you!

1 Like