Home    Features    Download    Screenshots    Manual    Reference    Forums    License    Contact    Blog   
 
 
  Forums
    FAQ    Search    Memberlist    Profile    Log in to check your private messages    Register    Log in   
[SOLVED] Custom collision handling in ODE

 
Post new topic   Reply to topic    Panda3D Forum Forum Index -> Scripting Issues
View previous topic :: View next topic  
Author Message
coppertop



Joined: 18 Apr 2009
Posts: 6

PostPosted: Fri Nov 06, 2009 5:33 pm    Post subject: [SOLVED] Custom collision handling in ODE Reply with quote

Hi all,

I want to use ODE for my game's physics. However, I also need Area Triggers and I haven't been able to figure out any more flexible way to deal with that that writing my own collision handling function. I got it to work, but I have one problem. I can't find out how to get the data required for OdeSurfaceParameters to put into OdeContact.setSurface().

I've checked the Panda's source code and it seems like auto_callback uses the OdeWorld's get_surface(surf1, surf2) function to dig everything out, but I haven't been able to get to that function from Python.

So my question is how can I get to that data (friction, bounce etc.) from Python? Also, if you guys have a better suggestion for Area Triggers than writing own collision callback I'm open to suggestions Smile.

Anyway, here's where I am now. I'm working with the ODE collisions example from the manual:
http://dl.dropbox.com/u/196274/odeCustoms.py

Any suggestions on the collision function are also welcome, if you see I screwed something up there.

Thanks in advance,

Coppertop


Last edited by coppertop on Sat Nov 07, 2009 7:49 am; edited 1 time in total
Back to top
View user's profile Send private message
rdb



Joined: 04 Dec 2006
Posts: 4557
Location: Netherlands

PostPosted: Sat Nov 07, 2009 2:17 am    Post subject: Reply with quote

With the auto-callback system, you need to preload the surface data into a table. This page explains it:
http://www.panda3d.org/wiki/index.php/Collision_Detection_with_ODE
_________________
I was formerly known as pro-rsoft
Back to top
View user's profile Send private message Send e-mail
coppertop



Joined: 18 Apr 2009
Posts: 6

PostPosted: Sat Nov 07, 2009 5:54 am    Post subject: Reply with quote

I know how to use autoCollide, and I know about the surface table.

I just don't know how to get that information out of that table for my own collision callback.

The thing is that the only way I see for making area triggers, and maybe some other things, with autoCollide is to call autoCollide a few times during a simulation step. It seems like I would need to create the area triggers, call autoCollide, destroy the triggers, clear the collision joint group, to make sure that the area trigger collisions only cause collision event to be sent, but do not participate in the rest of the process (i.e. that things won't bounce off of them and can penetrate them), and than call autoCollide again to make the actual collisions (this time without the Area Triggers existing in the ode space).

Now, I think, and correct me if I'm wrong, that calling autoCollide a few times and creating and destroying the Area Triggers' (and Rays') OdeGeoms during every simulation step is a waste. I though of a more efficient (at least I think it's more efficient, again, correct me if I'm wrong) way of doing that, which is as follows:

1) Make my own collision callback handling function.
2) Put Area Triggers, Rays, perhaps Kinematic Objects (like character controller) etc. into different lists.
3) Use the custom collision callback function to check every object against those lists to find out how to handle it (as a trigger, as a kinematic objects etc.).

Now, will that idea be more or perhaps less efficient than running autoCollide more than once during every single step, and still running through a few lists to recreate and destroy stuff?

And if it will be more efficient, how can I get to that surface data, because I see no way of doing that from Python...?

Also, maybe there is some other way, but I haven't found any way of setting OdeGeoms to "area triggerish" behavior, and even though collision events do the job of notifying me about a collision, I see no way of preventing ODE from preventing penetration on selected objects.

Coppertop

EDIT:

Ok, it seems like sometimes I just try too hard xD. For some reason I though I just HAVE TO use the OdeWorld's SurfaceTable even with my own Collision handler, while I do not... I've made my own list for surface data and it all works like a charm. I have to make my thinking more flexible in such cases xD. Thanks Smile

Coppertop
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Panda3D Forum Forum Index -> Scripting Issues All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
screenshot
Psychedelic Flythrough of the Mind of a Computer
screenshot
Flight Simulator, created by Carnegie Mellon students
screenshot
Super Duper Mario Bros: a cool variant of an old classic