Hey!
I’m making a tower placement system and I need to find a method of checking if a box isn’t touching another box and the main part is on a valid part,
How would I get multiple instances? Or is it always one only, thanks!
Having something like a boolean that ticks to true if the ray is not in the placement restriction area could possibly work, and ticks to false if the ray detects the restriction area
That’s not the current issue. This is the current issue:
This is not intended, and it shouldn’t be allowed to be placed buy RayCast only detects one instance. How would I get multiple?
Issue still not solved. I don’t know why, it’s kind of a simple answer: If and how?
I have seen this same problem solved using BasePart:GetTouchingParts(). With raycast it would be very complicated.
Seems good. Will take a look. Thanks! I could bind it into the RayCast somehow. I can find it, I’ve done some crazy things I didn’t know I could do.
Apparently, Anything with Can Collide get’s added. The boxes don’t have that.
Turns out I was wrong and you solved it entirely. You took a guess, and fixed something that took me a few days. Thank you, lol. You made my night (It’s 10 PM here, but you know what I mean).
You’d cast additional rays with the origin being the previous ray’s hit position and its goal being the previous ray’s direction multiplied by some magnitude (length).
Actually all I did was on the RenderStepped loop where it checked and changed CFrame, rotation, and it can be placed where it currently is. It only took 8 lines of code, and just for looped the GetTouchingParts to check for parts called “RangeBox” and the parent wasn’t the placing tower. Somehow, it actually works fine and it fit really well and I didn’t have to change a bunch of code to fit it. Very cool how some small guesses fixed something like this.
Didn’t realize the parts were touching and thus :GetTouchingParts()
would have been feasible.