Panda3D Collision System

Panda3D Collision System

Postby BenChang » Wed Oct 03, 2012 9:07 pm

Maya Collision Tag Options:

Under the Panda3D Menu, choose "Add Collision Tag Attribute". This will add a new attribute which you can access in the Channel Box. These options will change how the selected object is interpreted by Panda when it's loaded.

barrier: the geometry at this root and below defines an invisible solid
trigger: the geometry at this root and below defines an invisible trigger surface
sphere: geometry is replaced by the smallest enclosing collision sphere
tube: geometry is replaced by a collision tube
bubble: a collision sphere is placed around the geometry
ghost: geometry at this node and below should never be collided with

Barrier, Trigger, Sphere, and Tube make the selected object invisible - the object gets turned into a Collision Solid, rather than visible geometry. This lets you create simple geometry to use for collision detection that's separated from the actual geometry you see in the scene.
User avatar
BenChang
 
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Re: Panda3D Collision System

Postby cesarn » Sun Oct 07, 2012 10:31 pm

Professor Destefano mentioned something about a collision used in FPS games that would allow a from object to slide on/around a to object. How do I do this? I changed the example from class so that when a the vehicle hits an obstacle, it reads no user inputs. This is not working though, since when the user hits an object, they can just press the up arrow again and move through the object. Any help would be appreciated. Thanks!
cesarn
 
Posts: 2
Joined: Wed Aug 29, 2012 7:16 pm

Re: Panda3D Collision System

Postby BenChang » Sun Oct 07, 2012 11:20 pm

The easiest thing to use is the CollisionHandlerPusher. There are several collision handlers in the base Panda collision system. The CollisionHandlerQueue handler just keeps a list each frame of collisions, and then you go through the list and figure out what to do with them. The CollisionHandlerEvent handler sends events for different kinds of collisions. The CollisionHandlerPusher makes you stop and slide around walls and other obstacles. The CollisionHandlerFloor does the same with floors and is what I would want to use to fix the odd "falling through the floor" bug my demo code had during class last Wednesday.

take a look at the Panda Manual page on Collision Handlers.

Note there's also a "Physics" collision handler on there, which is designed for use with a basic physics system that's part of the Panda core. Panda also supports ODE and Bullet, which are two much more sophisticated physics systems, but have their own ways of dealing with collisions,so if you're thinking of doing something with a nice physics sim I'd suggest holding off a little bit until we get to those.
User avatar
BenChang
 
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Re: Panda3D Collision System

Postby fandubbed » Wed Oct 10, 2012 12:43 am

I am an artist and am quite confused with the workflow of the collision system. After I finish modeling an obstacle, do I add collision tag attribute to the obstacle itself? or do I create a simple geometry that cover the obstacle and add collision tag attribute to that?

Also, do I simply export model with collision tag attribute as an egg file? and what would be the best way to deal with the boundary of the environment?

Thank you very much.
fandubbed
 
Posts: 3
Joined: Mon Sep 10, 2012 6:07 pm

Re: Panda3D Collision System

Postby BenChang » Wed Oct 10, 2012 4:08 am

Usually it's best to create simple collision geometry and add the collision tag to that. Alternately, you can select the obstacle geometry itself and add the "Bubble" collision tag. This will automatically create a collision sphere that encompasses the whole geometry.

But making your own simple collision geometry and tagging it is usually better because you can carefully control the exact size of the collision volume.

Yes, you just export the .egg file like normal. there's nothing you have to set in the exporter to export the collision information; that happens automatically.

The best way to deal with the boundary of an environment is to make bounding walls and tag them with "Barrier". This makes them invisible boundaries. Keep the polycount really low on these - they use per-polygon collision, which is expensive.
User avatar
BenChang
 
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Re: Panda3D Collision System

Postby BenChang » Wed Oct 10, 2012 4:33 am

ship_coll_2.jpg


Here's an example of tagging a collision solid in Maya. I've just created a simple sphere around the spaceship, and tagged it with the "sphere" attribute.

terrainbarrier.jpg


Here's an example of a terrain with a barrier around the edge. It's tagged "barrier" so will become an invisible wall in Panda. Note this is actually kind of overkill - to make it look nice I had the wall follow the terrain, but in reality there's no reason you'd need to do that and it wastes polys.
Attachments
spaceship3.egg
(832.05 KiB) Downloaded 100 times
spaceship3.ma
(165.23 KiB) Downloaded 111 times
User avatar
BenChang
 
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron