I see your point, if you’ve played a tower defense game before, there is a box that stops you from packing towers to close, but when I add a box that is welded to the main part, it just falls threw everything.
I recommend to get rid of the box and use the RotatedRegion3 module instead. This way, you can check if the tower that you are placing is obstructed without raycasts.
Why not round the values of your placement system so the towers are placed on a grid. For example you can only place them at grid Positions (5, 0, 23) instead of (5.2, 0, 23.5).
How did you weld your placement boxes to the towers?
I don’t think it’s generally a good idea to rely on a external module for a vital part, and, it’s unneeded re-scripting.
A grid system is probably not good either, you need to tightly pack towers in most situations so it would pretty much get rid of it.
Are the towers different sizes, or all the same size? If they are all the same then why wouldn’t a grid work?
If they are all 1.4 studs wide then you could make the grid 1.5 studs. They’d pack against each other, but not overlap.
I understand that it may sound a little scary, but I think that it is worth to consider. It is quite popular and maintained in this GitHub repository. Also, it does not require a grid.
Towers would be different sized, and as I mentioned before, it removes the ability to tightly pack towers, so, people would just get mad and request it to be removed, putting me back into this position.
That eliminates 1/2 of the issue. The 2nd is the re-scripting, I think I may of come up with a alternative, but if it doesn’t work, I’ll try out this.
Well that is important information that you haven’t posted previously.
For us to help we need to know the details of what you are trying to accomplish.
You also haven’t answered
Turns out, I welded a test model and not the duplicating model, thanks for that, I wouldn’t of seen that if you didn’t ask lol. But now, it just ignores the box?
I’m just making it so the RangeBox is collide able with each other. How would I do this? The PhysicsService:
How would I enable collisions?
That’s only used in game with Physics. If you are placing it with CFrames I don’t think it works.
If you were doing it physically then you would only need to have the TowerBox colliding with Default and TowerBox. Since the Tower is inside the box it doesn’t make sense to have that.
Oh. Then how would I make it so if the tower is in the box it can’t be put there?
You can weld Parts (the tower) inside other Parts (the box).
You only need to worry about the boxes colliding, all the other Parts can be CanCollide off
That’s already been done. (CHAR)
Issue is not solved. All I need to know is how to get multiple instance returns from a raycast, not just one.
You can region3 where the raycast ends to see how many parts there in that area, or use the get touching parts method to see if they are touching or not.
Issue solved in another post. Thanks everyone for your help.
Turns out you can use BasePart:GetTouchingParts() In this situation
Please tell anyone searching this post what the Solution was, or link the post that solves it.