In my game framework , i m trying to set up the collision system in the following way:
For aModel_action, there is no issue because i’m creating my worlds with
the scene editor, so i just use the addCollisionObject feature .
For aModel_collide, there is an issue. Before creating my framework, i was simply putting a “{barrier}” flag in a simplified copy from my modelling package. It was working very good.
However from the SceneEditor i cannot do the same.
So i’ve got two way to do.
_ One is to extend SceneEditor with an option to allow to define another model as collisionNode (and not only Sphere…)
_ One is to emulate in my loading code for “aModel_collide” the effect of “Barrier” keyword.
For both Solution, i need to know either:
how to emulates the “barrier” keyword in my code
either how to set the “barrier” keyword on a model after load time.
I would appreciate any help.
Sorry to all if i written a long long description but i hope it make easier to understand the need…
The “barrier” flag tells the egg loader to create a bunch of CollisionPolygons instead of regular geometry. You therefore can’t apply it after you have loaded a model, since by then you have regular geometry and it’s too late (though you could conceivably write a program to walk through all of the vertices of the regular geometry and create the equivalent CollisionPolygons, but what a nuisance that would be).
The “barrier” flag is actually implemented via the line:
which appears in the 20_panda.prc file. This means that the “barrier” flag actually means the egg syntax " { Polyset descend }", which is egg syntax for making collision polygons.
You could define your own object types if you want, by adding similar lines to your own Config.prc file. For instance, you could define aModel_action and aModel_collide that set whatever collision flags are appropriate. But you’d still need to extend the SceneEditor to allow you to add your new flags.
Note that there are already a handful of standard flags you might be interested in; for instance, “trigger-sphere” sounds a lot like what you call “aModel_action”: it puts a low-resolution sphere around the object that is set as an intangible trigger-only object. I don’t know if the SceneEditor supports these flags, but if it doesn’t it’s probably easy to add.
Is it possible to define in the prc file some generic object type like
*_collide= {barrier} meaning all objects that finish by _collide are
considered as a barrier?
By the way , “trigger” seems very interresting.
Only way i see to have support of this kind of flag is to add a
kind of check box in Loading Model panel of SceneEditor.
There you select specific flags and a routine add them to the eggfile before loading it…
Second way to do would be to add an choice in the addcollision Panel.
This choice would be Custom Collision Model
then you will be prompted for a model and tag.
My routine create a copy of the selected model with the tag and
the copy is loaded .