# How to tell how long a single side of a part is

So I need help finding how long a side of a part is. I already have code that tells me which side the ray is hitting, I just need help with code to find out how long that part is.

I have not really tried anything since I don’t know where to start.

Any help is appreciated.

2 Likes

I’m confused on your issue. If you know which side it hit, then correlate that to the size of the part. Where the Right/Left is the X size, Back/Front is the Z size, and Top/Bottom is the Y size.

1 Like

I should rephrase that, the size of a single side. On a 2 dimensional plane.

You might just need to draw a picture because what I just wrote is the size of that single side. You want a scalar of the surface you hit, yes? It’s the part’s size on that axis.

So could I used what you said, but just not use the Z?

You’re drawing has 0 relation to what I said. I did not say a 3D box. You can get the two sizes from a single surface.

If the surface hit the Right side, use the Z and Y axes for your 2D “size.” Perform similar metrics for other surfaces.

1 Like

Why did you just reply with old information when I gave you an alternative above? That’s a bit rude…? Just replying with a repeat of the picture.

1 Like

I labeled the different lines on the drawing of what you said, and I drew it with that information, so I thought it was appropriate to tell you what I was referencing when I started drawing. Although I think I see what you mean now.

------>

Edit: Sorry if it seemed rude, I was just trying to understand what you were saying.

The side lengths of cuboid surfaces are subsets from the cuboid’s size Vector3. If you have a surface whose normal is parallel to the objects Z unit vector, then the surface side lengths are size.Y and size.X

1 Like