collisions using bitmasks

I think you all are tired with my questions, but i need help… :unamused:
it´s hard to describle but i will try:
i´m trying to create a block game, simillar to tetris game. and becouse of the different formats of the models, collision solids will not fit in the format of the models. and without a collision solid i can´t pick the objects. so i use the egg-optchar to flag the models. the pick works, using bitmasks in the models. now i can´t create the collisions of the models. how can i do a collision like collisionHandlerPusher, but using bitmasks?

The way you are doing it, you will need to know whether a block is set in place or not (whether or not a block is falling). That way, you can let your collision system know whether a block is a “from” or “into” object. While a block is moving, its an into object. When is set, change the bits so that it is a from object. The from bit should match the into bit (preferrably different than your picking bit). You can also add and remove colliders to the CollisionHandlerPusher as you set the into and from bits just to keep things in order.

thanks for the help, man. but i need more information. i have to set a from bit to match with the into bit, but different of the picking bit. so, i need two different bits for the objects? becouse the objects already have an into bit for the picking. and, for the collisionHandlerPusher, the syntax is "pusher.addCollider(collisionNode, object), right? but i don´t have collision nodes. what i have to put in the place of the collision node?
do you understand my problem?
:unamused:

If you dont have any CollisionNodes, you shouldn’t be able to set any bitmasks. Take whatever allowed you to set a bitmask to it, and try adding it to the pusher.

I don’t see why you can’t use collision solids.

You may even wanna consider using spheres!

I realize that spheres don’t cover blocks (as I guess you have in a Tetris game) very well.
But spheres are the work horses of collisionSolids, because they lead to simpler calculations.
Collisions can be performed against visible geometry as well, but this is expensive (in computer power).

Ok? Then how do you cover a tetris block with spheres?
Use a sphere for each block! You can even place several spheres in the same collisionNode, to have them work as a unit.

Here is a code example from a car game:
carCollNode=CollisionNode(“carColl”)
carCollNode.addSolid(CollisionSphere(0, 8, 0, 5)) #front sphere
carCollNode.addSolid(CollisionSphere(0, 1, 0 , 4)) #rear sphere

You may even wanna have a big and a small sphere in each object, to detect the vertices’ as well as the faces’ collisions.

Read more about it in the manual - there is also a video clip about using the scene editor for collision solids.

Have fun.

what you may do is to make a copy of the each egg file describing your blocks and mark them as “barrier”. this will create a collision node which is the exact replicata of the source block. Panda make this collision node non visible by default which is fine.

When you load your block.egg you load your block_barrier.egg also.
Then you reparent block_barrier to block.
this way you can set bitmaks and so on to block_barrier and make
pusher.addCollider(block_barrier, block).

Currently to mark a egg file as barrier, you have to edit it manually to
add the { barrier } at the line after the .

I’m working on a way to do it in automatic from scene Editor but is not working yet

hey Rainow Brite, you´ve convinced me to use collision spheres. but now, the collision is not working with the picking. :frowning:
has there any more thing to do?