I’m playing around with the basics of collision handling and was wondering if there is perhaps a way to perform the following collision (I’m pretty sure there isn’t but I guess it’s worth a shot in the forum):

My characters are 2d animations on billboard-nodes (regular textures which I switch every few miliseconds).
The “field” consists of several 3d boxes. The game is a platformer, meaning that the boxes are treated as rectangles for collisions.
Now: In the 2d animations the characters are basically all the opaque pixels, while the transparent pixels are not part of the character.
Is there a way to test collisions based only on the opaque parts of each texture?

I hope I explained myself,

afaik panda doesnt perform pixel-based collision. you might need to use a seperate 2d-collision library for that.

I’m not sure really about 2d, but for 3d, you could add the texture to a singal flate surface, then cut around the image you want, then the rest you would just add the collision tag to giving you a 2 poly count object (give or take). I would think you could do this with textures/cards too, no?

@adr: I like your direction. Would you (or anyone else) care to elaborate? I’m not quite sure how to do what you’re suggesting…

Could you post one of your images?

Here is one of the images I’m currently using (note that the current images are placeholders, while my designer is working on the actual images, but they will be more or less the same shape).


My idea was just to get around the pixel one, but question tho, why not just make a simple collision sphere around the part you just want to test for collision instead? It be less complex.

astelix has made a great collision tut:

By setting its .setRadius you can make it smaller or bigger as you need seeing as you said they are animated.

Well, I went over the suggested tutorial and it indeed explained the subject very well.
What I still have trouble figuring out is:

  1. How can I deal with floor collisions? In the tutorial examples the floors are terrains. In my game (a 2.5d platformer) the floors are a bunch of floating boxes.
  2. How can I know the direction of the collision (if it is from below then the avatar can stop falling, if from the side can stop walking and keep falling etc.).

Any suggestions?

  1. Use a collision handler, attach it to your model, the sphere should let you test for collision for the boxs. Terrains are just the top part of a box really.
  2. Will happen autoly (if I understood you right)

Just follow his tuts and it should work fine; if not, just show us whats going on and we’re look at it.