How does one use Collision Groups?

Another area I’m not good on. Never tried this and all the documentation on the Wiki is not helpful.

Basically there’s this board in the middle of a piece of railway track. Normally, before Collision Groups came, games would have them cancollide off, so trains could go through and people could still walk over. Obviously times have changed.

image

This is the part. It’s currently uncancollidable, but I want to make it so that players collide with it using Collision Groups. How do I do this?

Thanks.

3 Likes

If the part has CanCollide set to false, then nothing will collide with it.

Instead of trying to make the characters have collisions with then part when it has CanCollide set to false, instead make everything else not collide with it, and have CanCollide set to true.

So you would want to create a collision group for the players’ characters and make all the parts of the character use that collision group, and create a collision group for that part. The collision group for that part shouldn’t have collisions with the default collision group.
(the part should probably be anchored so it doesn’t fall out of the world)
image

Result


collisiongroups.rbxl (15.5 KB)

2 Likes

Unfortunately non can collidable trains won’t work because then that way the realism is buggered

How so? Hypothetically, if you set a collision group called ‘PedestrianCrossings’ and another called ‘Trains’, and you make it so the the collision groups don’t collide with each other (obviously CanCollide must always be true), then everything (including players) except your trains will interact with each other. I would assume this keeps the realism you intended.

The image appears to be rails so I’m assuming you have trains.

Turn it’s collisions on. Make two groups; one for trains, one for parts it has to bypass. Collidable parts of trains should be set to the train group and bypass parts to the second group. Make the two groups not collide with each other. Done.

Alternatively, the bad way, just create NoCollisionConstraints between the collidable parts of trains and the track part it has to bypass.