What I’m trying to achieve can be shown very similarly to what redstone in Minecraft is like. If you place redstone dust with no other dust around it, its a dot, but when there is dust next to it, it connects. How can I achieve this?
Can we have more details on what you currently have? Do you have a Voxel/grid to work with? Where do the parts come from? How are they created?
From what I understand, the easiest way to do it would be to check part:GetTouchingParts(). If there are similar redstone parts touching, you then change the parts shape accordingly.
I use maths for calculating my grid, and it isnt an object or array of objects. If i place a tile, I just round the x and z position to a multiple of 4. Each tile is 4x4 studs. The parts will be normal parts, with about a size of (4, 0.1, 4) and transparent with a decal. They are created like parts normally are.
I understand the use of
workspace:GetPartsInPart but I just want to know how i would go about changing the decal to whatever i need to. For example, if there are 3 branches out from 1 tile, I need to change the image to the 3 branch one and rotate it accordingly, or have a table base of decals with no rotation. What I’m asking is how to figure out how many branches there are and/or how to update the decal accordingly
Well after using GetPartsInPart and comparing parts to detect if they are redstone, you must then check where they are compared to the current part by substracting both positions. This will give you a direction vector which should indicate where the other redstone piece is. Then, have an array of all decals you want and filter trough them to find the one according to what you need.
Ex: you have 2 adjacent redstone. One X+, one Y-.
Since they are only 2 and they are on different axis, you can verify that it makes the form of an L. Then, get the decal which represents an L and paste it on the part and rotate it to align with other redstone. (Make sure to update nearby parts aswell when a new one is placed)
Another way would be to have every single possibilities in an array, and instead of pasting the L and rotating it, you would just have to paste the L that has the correct rotation.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.