Raycasted Decal System

Hello, everyone!

I’m really excited about this, as it’s my first time making something as complex as this (might not actually be that complex, but it’s still something I haven’t been able to do for a while. )

Anyways, it’s a raycasted decal system that creates decals that map to the surface correctly.

It also spawns another raycast if it detects a humanoid, which also goes through said humanoid, and changes the texture of the decal on the otherside of the humanoid - if there’s not another one directly behind it.

Screenshots




image

I might open source this since there’s currently nothing else on Roblox’s toolbox that has the same level of quality as this. All it requires is a “hook” from a raycast function.

Game That It's Being Used In (and was originally purposed for)

Redshift Arena: CLASSIC - Roblox

Please note that Deathmatch & Infection currently do not utilize this system, and as such, may break. Only CTF & Team Deathmatch have this system currently!

21 Likes

teach me

3 Likes

Cross Product, Re-casting rays, and a little bit of math.

I might move this over to #learning-resources:community-tutorials-resources if I decide to open source it. Probably will be after I transition it to a surface-GUI instead of a part-based decal system so the decals are clipped.

3 Likes

YOOOO!
I worked on a system like this for Brutal a while back, could never think of an efficient way to get it to wrap around non-base shapes though!

Makes things super messy in-game!

3 Likes

Lookin’ good!

Try implementing the dot product with your script (it might work for yours.)

All I’m doing is translating the position in which the ray collides and what that translates to on a scaled UDim2 SurfaceUI element. Super quick to solve, and I’m pretty sure I’m doing a messy job of it at that.

Because of how I’m solving it though, I can also utilise it in .Touched things as well! Its not accurate when used in a larger object, but in smaller ones with non-accuracy needed its incredibly useful.

I’m not entirely sure how I could utilise Dot product at the moment, as I’d then have to solve to create additional parts and sizes.

I recently contracted someone to make this exact functionality because I was too bad at math to figure it out myself

Edit: reworded to not give specific amount

2 Likes

That’s a lot for something really simple (imo.)

Well, at the end of the day, it might be simple. But I wasn’t able to figure it out, and I needed it quickly. 15,000R$ is not that much to me if it means figuring out an important aspect of a game.

1 Like

Makes sense - I think I would have done the same to be entirely honest.

I didn’t really intend it as a flex, I suppose I shouldn’t have used a specific amount. I’ll reword it.

I just thought it was funny that I had to contract someone out not long ago and then just a couple of months later somebody posts exactly what I needed and contemplated giving it out for free.

1 Like

it was a joke :slight_smile:

1 Like

This is awesome. Reminds me of that old spray paint gear (rip).

If you open-source it I could definitely find a use for it :wink:

2 Likes

Haha, well, I intend on open-sourcing it once I make it Surface-GUI based, so that the decals are cut off when they’re shot at an edge.

Edit:
I think surface guis are out of my league - they’re always stretched when they’re on a part. Plus, I can’t seem to get the normal.

2 Likes

I just remembered why it was hard for me. I wanted it so that a decal couldn’t extend over the edge of the face it’s on. That’s what I couldn’t figure out.

wait how did you even manage to make it curve around spheres this is black magic

Isn’t it suppose to bend around corners???

1 Like

It currently does not do that - it wraps to complex geometry (i.e. a sphere) but if there is a corner, it doesn’t cut off.

Oh, but isn’t there like already an open source version of this on the wiki under the RayCasting API for getting surfaces on spheres?

The dot product page, yes.