Making parts within a bigger 'line' part

Hey Developers! I’m a scripter, but I am not at all good with CFrames! Basically I have this part which acts like a line in the wall, but I need to a ‘start’ and an ‘end’ part.

In green, is this line. You see I want to place a part in each of yellow sections. But this issue is that the ‘line’ part can be in different orientations.

Another issue that I would like is to make the yellow part the thickness of the line as indicated with the red arrows below:

Again, I’m having the same issue of that, it can be in different orientations!!

I’ve been stuck for hours and am willing to try anything! Any and all help is much appreciated.

1 Like

Have you tried using CFrame:VectorToWorldSpace? I am making a placement system for my game, and it has rotation on all 3 axes, which made it difficult for me to calculate the offsets for a part when it’s in a different orientation.

Here is an example:

local worldSize = part.CFrame:VectorToWorldSpace(part.Size)
worldSize = Vector3.new(
	math.abs(worldSize.X), 
	math.abs(worldSize.Y), 
	math.abs(worldSize.Z)
)

What this will do is calculate the size of that part (in the world, so rotations are applied), and store it in a Vector3.

If you still don’t understand, here is a better explaination:

Below is just a regular part. It has a size of 4, 1, 2, and does not have any orientation applied to it:

Its “world size” is the same: 4, 1, 2.

Now, suppose I rotate the part by 90 degrees on the z-axis (as an example):

The size is still the same (4, 1, 2), but it has an orientation of 0, 0, 90. So when we get the “world size” of the part (after applying abs to all 3 numbers in the Vector3), which is 1, 4, 2.

As you can see, this can be extremely useful as it allows you to perform calculations without having to worry about the part’s orientation. Hope this helps!