How would I go about making a tattoo system

Hello, I am trying to make a tattoo system where random R15 dummies come in and you can give them a tattoo. The problem is, I don’t really know how I would start this.

My first idea was to get SurfaceGui’s, put them on all parts of the R15 dummy’s body, put frames on them, then detect whether the players mouse is down and is on one of the Frames (and if so then a small dot is cloned onto it). The problem with this is, SurfaceGui’s don’t wrap around meshes and curved objects.

I tried looking into something called the SurfaceGuiWrapper Module, but I don’t think it works for meshes.

How would I find alternative ways to make a tattoo system, or extend on the SurfaceGui idea?

There isn’t really a good way to do this.

You could try turning the drawing into basic shapes (lines, dots, etc.) and then resize and bend those shapes with bones to get them to fit the mesh (use raycasting to get surface info to bend).

You could also try the simpler way of just making a bunch of small dot meshparts, maybe a few variations for different curves on the mesh.

Is there no way to make it 2D?

You could bend a flat mesh with a line texture to make it flat on the character. It would be roughly 2D relative to the surface of the character’s mesh.

How exactly would I bend the flat mesh?

You could use bones/mesh deformation:

There is an open sourced thing that does this:

(Unfortunately the videos are gone. The plugin curves decals around meshes. Some of the examples were putting foliage textures on to ruins and stuff. I would reference the module’s code but probably not use it since it creates more bones than you need for your use-case.)

How would I use these Deformation things for what I’m trying to achieve?

If the player draws a line, you add a line and bend the line around the mesh. If the player draws a dot, you add a dot and bend the dot around the mesh.

It’s the same thing as drawing on a surface GUI but with MeshParts instead of frames, except that the MeshParts can be bent around the mesh.

Okay, so I am currently trying to use the top post as a method, and I cannot really figure out how I would use that for this situation.

Yeah, sorry about that. That tutorial isn’t really a tutorial.

The plugin’s code is probably more relevant:

(Image of builderman with 2D builderman wrapped around arm)

The code wraps flat meshes (with textures) around meshes.

I was thinking you could have a flat mesh for each stroke the player draws and wrap each stroke to the target mesh:

Hey uh… how did you do that?

Am I looking at Texturing? Because that shouldn’t be possible yet. Roblox has not released Projection Texturing. I got pinged so I’m interested.

Oh, so like whenever the player draws, I clone one of those things, put a dot decal on it, and put it near the position of where the player drew?

How would I make the decal part have a perfect orientation and position of where the player drew?

It’s a mesh of a flat plane with bones spread across it in a grid pattern. Rays are casted down from the mesh’s original position to find the height of the stuff below it, then the bones are moved downwards based on the raycast results. Moving the bones bends the mesh downwards over the stuff below it.

The flat plane then has an image/decal inputted as its texture.

It’s some raycasting math, it depends on how your drawing system works.

If it’s 2D, you can just make an array of 2D points for the path the player draws, raycast downwards to find the height the bones need to be at, then position the bones. (In addition to using the bones to make the texture wrap around the mesh, you can use the bones to bend the texture to the curve the player draws.)

If it’s 3D, you’ll need to raycast to the point the character draws, store an array of the points and surface normals. Once you have that, you can generate the points needed based on the width of the drawing stroke and the surface normals with more raycasting.

You could install the plugin to try it out and look at its code.

(Edit: Important: The mesh must be set to precise vertex decomposition while drawing or the raycasting won’t be accurate enough)

Unfortunately, I am not good at raycasting and bones and stuff like that. Could you tell me a bit more about what I should probably do?

Sorry, it would be a lot of work to design this completely, there are a lot of features this would probably need and a lot of math to be done.

For example:

  • Meshes with different grids of bones would need to be created (ex: 3x2, 3x5, 3x10, etc.)
  • The code would need to decide what to consider a point on the final drawing path
  • The code would need to use some vector math to calculate the positions of the outer bones with the surface normals then generate vectors for raycasting the positions.
  • The width would need to decrease around curves of the path to avoid clipping, so curving would need to be calculated

There are just a lot of things and I don’t think I can explain the entire thing to you.

Mesh Wrap Test.rbxl (132.6 KB)