Invisible collision geometry


I’ve been working on figuring collisions. While I do know how to get collisions to work on already visible meshes, I would like to be able to make objects which while visually complex have simpler collision geometry which is not rendered. So more or less it’s something that moves along with the “beauty” model(or perhaps the other way round), but collisions are handled by the invisible collider in stead.

I’ve tried some searches, but I’m not sure if I’m looking for the right things, since the closest terminology I can think of is “hitbox” but I haven’t turned up much using that or any other terminology I can think of.

More or less I’m looking for a tutorial/help to get me going on creating a mesh with an invisible collision mesh outside of it(working in blender and using chicken exporter). So do I model out the beauty mesh as well as the collider in blender then export? If so, are there some tags I attach to the collision mesh which tell it to be invisible/have collisions? or do I simply apply an all alpha texture to it to make it invisible?

Or am I just barking up the wrong tree and are collision solids the only avenue for invisible collider meshes in Panda?

thanks in advance.


I think what you’re looking for are Collision Solids. Check this out:

edit: i missed your last sentence, so just ignore my post :wink:

edit2: did you have a look at the CollisionPolygon class?

Collision solids are not the only solution but they are by far the best.

A collision sphere beats anything else, it’s fast, in can be a into and a from object.

But if for some reason you need to make a more complex or a more fitting collision solid, then you can make one yourself from polygons.

Some exporters have options for that, but if you’re not using one of them it’s still easy to mark some geometry as collision.

Open your egg file in notepad or any other text editor find the tag and under it add a collision entry like { Polyset descend }

It should look something like this:

  <Group> Sphere01 {
  <Collide> { Polyset descend }
    <VertexPool> Sphere01.verts {
      <Vertex> 0 {
        -2.54657 -0.669373 18.0978
        <Normal> { 3.16734e-008 -1.84761e-008 1 }
      <Vertex> 1 {
        -2.54657 9.96824 14.6414
        <Normal> { -1.95503e-007 0.625226 0.780444 }
      <Vertex> 2 {

You can also use:
the manual says it has the same effect as { Polyset descend }, but I’ve never tried it myself.

thanks for the responses, I am curious though, when using collision solids, it seems that the only way to tell it where to go and what orientation to have is through coordinates, like on the tube which requires two sets of end coordinates. However what if I’m setting up collisions for a character and want to use tubes for the different parts of the limbs (one for forearm, one for bicep, etc.), how do I line up the tube with each part of the body without figuring out the end points?

Also, I’ve found out that I can create a model in blender, then create a separate simpler mesh in the same scene, set the simpler mesh to be collideable but not visible and export the two into a single egg file, and when attempting to check for collisions, panda will only check the simpler yet invisible geometry to see if there was a collision, is this correct?

If you want to use the collision solid for an avatar with animations then the only way I know is to expose the joints and attach the solids to the bones (check out “looking & gripping” sample). If you make a animated mesh and try to use it for collisions it won’t actually be animated.