Using modeled geometry as collisionSolid

I’m scripting an actionRPG game, and i need to some help to get combat collision working.

I want to use as a collisionSolid an optimized model i stored in a .egg file, rather than generate at run-time a lot of collisionPolygons.

If i just load my collision geometry and add it to cTrav with the appropriate handler, it tells me that the collisionSolid is empty.
But if I create a collisionNode, i can only add the built-in collisionSolids…

So I’d like to know if there’s a workaround for this.

You mean your CollisionNode is empty? (The CollisionNode is the container class, and it contains zero or more CollisionSolids. A CollisionSolid is never empty, it is one of the standard solid types, CollisionSphere, CollisionPolygon, or so on.)

What you describe should work fine. You can load a CollisionNode from an egg file and attach it to a traverser. If the traverser is complaining that your CollisionNode is empty, then there must be something wrong with your egg file, or maybe you didn’t get a pointer to the right CollisionNode from your egg file.

Note, however, that only a CollisionSphere or CollisionRay can be attached to a traverser; a CollisionPolygon (or a mesh of CollisionPolygons) is not a valid “from” object. Since a CollisionSphere is a fairly simple object, there’s usually not a lot of reason to load one of these from an egg file; you can define one in code just as easily.


Thank you for your answer.
Yep, it was the CollisionNode to be empty.

Anyway, I decided to use CollisionSegment, and now it works fine!

I couldn’t use a sphere because I designed the weapons to be “from” objects; and a sword isn’t exactly spherical :stuck_out_tongue: