How to put collision polygons on GeomTri, GeomTrifan/Strip

Hi again everyone

I need to check collision against objects that consists of GeomTrifans and GeomTriStrip, so I would like to put collision polygons “on top” of every GeomTri object in the strip and fan objects. Problem is that I can’t get the GeomTri objects out of the strip and fans object, and I can’t get any (x,y,z) values out of the GeomTri objects.

Do anyone know how do this task (in python)?

Thanx

Mads

You don’t need to create CollisionPolygons first in order to test against visible geometry (GeomTrifans and GeomTristrips). You can collide directly with the Geom objects, as if they were collision polygons.

To do this, just set the collide mask on your visible geometry so it has some bits in common with your moving object’s collide mask (by default, it doesn’t), e.g.:


geomNodePath.setCollideMask(BitMask32(0x01))

David

OK

But as I’ve read the documentation (which I know now to be somewhat outdated) you can not be sure to have the same information availble on collision with geometry as when using collisionnodes. Can you confirm that this is not the fact? hoping

I really need surface points and normals to make my collision scheme work properly.

Thanx yet again for answering posts so fast.

/Mads

I’m not sure where in the documentation it says otherwise, but you do get the same information, including surface points and normals, from collision with geometry that you get from collision with regular CollisionPolygons.

The only thing that you give up when you decide to use collision with geometry is a bit of runtime performance, since there is greater overhead when colliding with visible geometry.

David

Is there a way to specify what names should be sent with events when a collision with geometry occurs.

E.g. when I make a collision node: col = CollsionSphere(“yada”)

And use a collisionhandlerevent is there a way of specifying the string name of the events it sends when colliding with geometry like “into-objectsomethinglikeaname”

right now it seems to me like collisions with geometry either produces an event string like “into-” (i’ve specified this to be the pattern, yes) or it produces an event string like “into- /root/nodepath/balsdafda/geometriobject”

Is there a way of controlling these names?

Best regards
Mads

Hmm, I’m not sure completely what you mean. If you event handler’s in_pattern is “into-%in”, then the name generated will be “into-”, where is the name of the GeomNode that contained your geometry. At least that is the way it is supposed to work.

This is similar to the way it works when you are colliding with a regular CollisionPolygon, except in that case is the name of the CollisionNode that contains your collision solids.

If your GeomNode’s name isn’t useful, you don’t have to use “%in” in the in_pattern. There are many possibilities, like “%(mytag)it” to use the value of the tag “mytag”, or “%ig” to include the string “g” if you have collide with geometry. See collisionHandlerEvent.I for the complete list.

David