Collide function with near callback in ODE

Registered by Jeiel Aranal

In the OdeSpace, add a collide function that takes a near callback function for ODE to clear up the ambiguity of setting the collision joints.

Blueprint information

Status:
Complete
Approver:
rdb
Priority:
Medium
Drafter:
rdb
Direction:
Needs approval
Assignee:
rdb
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon 1.6.0
Started by
rdb
Completed by
rdb

Related branches

Sprints

Whiteboard

(pro-rsoft) I have my doubts about this. Why want to setup near_callbacks when theres autoCollide and the surface table? I mean, all one would do in a near_callback is setup collision joints, but this is something autoCollide can do for you as well.

(ZeroByte) One thing that you can do by setting up your own near_callback function is use the ODE collision engine to call collision events in your own code instead of having to setup the panda collision system again to do collision detection. Another thing you could do is filter collision events depending on collision objects. While its probably recommended to do collision filtering using CollideBit/CategoryBit there might be times when you want to filter based on the position of your objects, for example to create one way doors. It's not necessary but its another level of control that would be nice to have.

An alternative solution is to be able to pass an optional function argument to autoCollide() as a collision callback. The collision callback function takes two OdeBody's as its argument and returns a True or False. This collision callback function is passed to autoCallback() as an optional argument and the function is called whenever a collision occurs. If it returns true, the collision joint is created if false it isn't.

(pro-rsoft) Hmm, I'm not so very sure about the True/False idea, but the callback/events thing can be a good idea. Unfortunately, when you have lots of objects colliding, letting autoCollide call a python callback every time something hits might cost some performance. Therefore, I'd prefer the near_callback approach. And/or, a way to be able to grab the joints from a JointGroup, so one can loop through them and modify them.

(pro-rsoft) Implemented. I just made a separate collide() function to OdeSpace that works entirely the same as in PyOde.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.