Not understand to collision detection with bitmask

I recently working on bitmask collision detection, I have added the < collision > tag to my egg models, but how shall I use it properly to detect the collision between them, such as:

floor_with_some_little_mountain=loader.loadModel(floor.egg)
human_body=loader.loadModel(human.egg)
ball=loader.loadModel(ball.egg)

p.s. all of the models are all with the collide tag in their vertex group

p.s. I wondered if I shall use bitmask32, a lot of example used it but it seemed didn’t work on mine, or maybe my code is wrong(T_T)

(^ω^)

thanks for advance

Hmm… Could I ask you to clarify, please: is the problem that you have collisions occurring that you don’t want to have occurring, or that you don’t have any collisions occurring at all?

I can add that you can’t push mesh between each other, it will work with bodies, a ray.

I didn’t get or more clearly I don’t know how to, cuz I cannot see some "if " in the bitmask example

what I want to ask is that: what is the occurs, the way to use this tag, and how do we detect two diff model collide(if condition or something else(?))

also I want to ask if it is posibble to make a rugged map into a collidable object by adding the and with bitmask?

a ray? I saw that everywhere in the exaple but what it is affecting in the code?

Simply put, bit-masks are used to limit which things can collide with which other things. With no bit-masks applied, all things collide with all other things (well, with the exception of visible geometry).

Note, however, that bit-masks are not required in order to get things colliding; as mentioned above, they’re filters, a means of restricting which things may collide. If you’re not getting any collisions at all, then the problem likely has another source.

(The exception is visible geometry: by default, ordinary, non-collision geometry doesn’t take part in collisions. A bit-mask can be used in order to change this. However, it’s often unwise to do so, as non-collision geometry isn’t set up for efficient collision, I believe.)

(By the way, you don’t need to create multiple posts in a row to include new information–you can edit your posts via the “pencil” icon at their bottom-right.)

[edit]
If you haven’t already seen it, this may be of use to you: I have a “beginner’s tutorial”, part of which deals with collision. It uses the built-in collision-shapes rather than mesh-shapes, but the basic principles should be the same.

You should find the first lesson that covers collision here, I believe:

2 Likes

I got want you mean!! Thanks for the advises, I will go watch the lessons now!!

1 Like

It’s my pleasure, and I hope that the lessons help! :slight_smile:

1 Like