collision layer an collision mask godot

Collision mask bit is for choosing what layer should be collided.

Let's assume we set collision layer and mask layer as below.

Player node : collision layer is on 1st bit / mask layer is on 2nd,3rd bit
Enemy node : collision layer is on 2nd bit / mask layer is on 1st bit
Object node : collision layer is on 3rd bit / mask layer is on 1st bit

then,
Player mask(2) == Enemy layer(2)
Player mask(3) == Object layer(3)
so, Player can be collided with Enemy and Object.

but Enemy nodes are not collided each other or Object nodes.
Because Enemy mask(1) != Enemy layer(2) / Enemy mask(1) != Object layer(3)

Are there any code examples left?
New code examples in category Go
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source