CURSE YOU COLLISIONS AND MAYA [Solved]

GRAGH, I’m dying here, someone please help me…

Basically, I need to find a way how to incorporate a combination of
a) Collision solids imported from Maya
b) Pushers
c) The ability to land on top of objects
d) Triggers
to create LEVELS in Maya and import them into Panda3D without having to manually create a whole bunch of collisionSolids in Panda3D following the maya model…

The issue is…

a) How do I set tags to collisionSolids I create in Maya? Like, where am I supposed to add them in the egg file?

b) Theres this weird issue I have where if I jump AGAINST an object, to its top, my character will “spasm” and jump sidewards. I’m currently using a combination of CollisionHandlerPusher (for the sides) and a regular collision plane on the top + collisionHandlerEvent between a ray that I cast from the character and the collisionPlane, to direct my character to move downwards until it has reached the object below it. Can anyone tell me whether the use of 2 different methods is the reason why my character spasms?

c) Around the same as B, although I’ve been also wondering. Would it be better if i used CollisionHandlerFloor instead? To replace the top of the object. And if I do that, how do I incorporate that with making the collision solids in Maya? 'cuz I think I need different type of collisionHandler for each situation, such as one for the top of the object and one for the sides…

d) How do I work with triggers? That option that you have when you are choosing the egg object type in maya using the mel script, how does that work?

And it would be AWESOMELY helpful if someone could tell me whether how I am doing things is wrong, and whether there is a much better way of incorporating a system where I can:

a) “Slide” against an object when I move against them (a.k.a Pushers)
b) Land on top of an object when I jump onto them, or land on floors, and fall off them
c) Make it such that if i collide with certain objects, different events will happen (e.g if i hit an enemy, my health will decrease, but if i hit a switch, a door will open, etc)

Thank you for taking your time to read this, give me advice if you can!

Try this first not by trying to set tags but just setting the collidemask on the geometry, as long as the geometry is simple. If the geometry starts getting complex, that’s where you’d want to make other collision geometry and tag it in Maya using the MEL script to add the tag attributes.

Here’s what’s working for me:

  • Use a Pusher for walls

  • Use a Queue to check for floors - with Floor and Event it seems to be more difficult to deal with jumping off of things. Use a Segment instead of a Ray; that way you can fall down towards the ground, instead of having the ray instantly find a collision and snap you to the floor

  • for touching / triggering different types of objects, I think you’d set the tag property to “door”, “enemy”, “food”, etc., use CollisionHandlerEvent and route the events to functions based on the tag or other criteria.

As to (b): I’m not at all sure, but if if I’m correct in interpreting your description, then it occurs to me that you might have your character collider detecting a collision against one or more walls, determining that it is behind them (as would, I imagine, be the case if the character were on top of the object), and so moving the character to a position “outside” of the walls - potentially appearing to be a “jump” to the side.

THANKS EVERYONE! I would bend down and kiss your feet, but thats unhygenic and difficult due to distance.

Thaumaturge, you were right, my character sphere was colliding with the top apparently. So i borrowed benchang’s idea of working with collision masks, and made it such that the ground ray and the object top’s collision masks were the same, and the collision sphere and the object’s sides’ collision masks were the same as well, such that only those two pairs could collide with each other. It worked BRILLIANTLY! Not only was I able to avoid the issue about spasming, but I was able to apply it to the model as well, where I separated the floor bits of the model and the walls bits into 2 egg files, and gave them different collision masks!

And Benchang, THANK YOU SO MUCH FOR THE IDEA OF USING QUEUES. I made it such that my ground ray’s collision handler was a queue type, and it solved a HUGE bug which occured later when I had overlapping collisions, and made my collision code ALOT simpler.

And for those who have problems with tagging parts of models in an egg file, what I did was to dynamically add the tags when they were created (was quite lazy, I believe there is a as well for eggs) by finding all the collision nodes in the model using findAllMatches, and setting tags on them.

Once again, much appreciated everyone!