Skip to content

How to make collision group collide with itself #2769

Answered by eonarheim
KostarSf asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @KostarSf this is a great question!

I think the issue here is that both new groups playerCanCollideWith and asteroidsCanCollideWith are technically the same group. This feature in Excalibur is very confusing, each group is a category that won't self collide. There is a special built in group CollisionGroup.All that collides with everything.

In Excalibur things of the same group do not collide by default, here is an example that you can use to check:

const asteroidGroup = ex.CollisionGroupManager.create("asteroid");
const playerGroup = ex.CollisionGroupManager.create("player");

const asteroidsCanCollideWith = ex.CollisionGroup.collidesWith([
  asteroidGroup,
  playerGroup,
]);

const p…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@eonarheim
Comment options

@KostarSf
Comment options

Answer selected by KostarSf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants