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?
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.
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.
(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.)
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.
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.
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.