I’m trying to script a bus that has motorized doors. Although, I need the door model to clip through the body model. Using CollisionGroups is quite janky since if I need to duplicate buses and link them to the same CollisionGroup. As well as a limit to how many CollisionGroups you can make.
I was thinking of using “NoCollisionConstraint”, but I couldn’t link it by group, considering that the doors will need to clip through many parts. My existing code is using CollisionGroups which isn’t as effective.
game:GetService("PhysicsService"):CollisionGroupSetCollidable("Body", "Misc", false)
I’m trying to find a most efficient way for the doors, wheels, foldable seats, and more not collide with the body itself, since I’m using HingeConstraints for part movement, and I know it will spaz if collision isn’t turned off between the Body model and the part itself. Misc and Body are the two groups that needs to have collision off for each other.
Just use a for loop for all descendants of the models and put them in two separate collision groups.
Then, make the collision groups not collide with each other. Pretty straightforward if using Instance:GetDescendants().
Keep in mind that if you do something such as make Body not collide with itself, then different buses may be able to go through each other. This can be resolved by making your own little box colliders for the bus (highly recommended) that are less complex than the bus mesh/body itself.
Also note that collision groups can be a one-time assignment, as they will persist even if the model is cloned (so it doesn’t have to be done every time you wish to spawn a new bus for example).