Making a ray go through the whole part

So I want to create a ray based off of the size and position of a part. However the problem is that I’m struggling to figure out how I can make it start from one end of the part instead of the centre.


What I want to acheive:

I would appreciate and help, thanks.

to get on side of the part depends, on the size x, y, z; say Z is your longer sized portion

local leftwardBoundCFrame = Part.CFrame -, 0, Part.Size.Z/2)
local rightwardBoundCFrame = Part.CFrame +, 0, Part.Size.Z/2)

1 Like

Oof, how would I also account for the rotation of the part?

NonessentialCoder is saving the CFrame boundary, so yeah the rotation is taken care of as well

1 Like

Also if you’re wondering why we divide by two, it’s because the position of any part is at its center, which means if we wanna get the part’s left boundary or right boundary we would have to add or subtract a half.



If you want to make it easier. use the event: TouchEnded

Going to just edit this because I feel like that came off a little rude. Sorry.

Touch ended wouldn’t be practical for what Im trying to do but thanks anyways

Oh sorry, I didnt understand you correctly.