Page MenuHome

Python collision callback
Closed, ResolvedPublicPATCH

Description

This patch adds support for a collision callback.
Currently it only informs you of the object you collide with.
This patch leverages the existing collision callbacks for the Touch sensors.

In order to add more information one would need to expand the touch system.

Event Timeline

Added demo file and newer, fixed release (to support properly sensor objects)

First off, you've got some whitespace/clean/style changes in your patch; those should really be in a separate patch (e.g., the .style changes to CcdPhysicsEnvironment.cpp). Also, should we be able to register more than on callback like we can with KX_Scene.pre_draw and post_draw? Lastly, isn't the KX_TouchEventManager mostly just used for logic bricks? I seem to remember a different place where I added in calling the callback when I played around with this...

Added new file that removes CcdPhysicsEnvironment.cpp from patch.
Added list-style callbacks
Using touch manager. This is because the collision behaviour rules that the user is used to are implemented on top of bullet using callbacks defined in TouchManager. Without using touch manager, you'd be writing the same code, and a lot of work would be required to ensure that the two systems remain exclusive to one another.
The reason you didn't use it before was that you used directly the Bullet update, however, in the event of sensor objects, they only involve themselves in collisions if they have registered sensors, so we have to extend that to treat callbacks as "sensors"

Are we always guaranteed to have a touch manager, even if we don't have logic bricks that use them? I haven't dug into the managers too much...

Assigning this to Benoit for final review/okay.

Added support for the contact points from Bullet. These are also provided to the sensors now. Had to add a struct container to support forward declaring a vector type.

This patch is since r60132 14.09.2013 (r60208) in the trunk.
I think this patch can be closed.


Added new file with support for contact point information. This is available from the sensor as well as the callbacks.

Modified previous patches to avoid random containers and use correct dt.
This now is a final patch.

However, it doesn't seem sensible that the Impulse values change with substep changes, I can't produce reliable information. Best to avoid this for now.

If the patch is "final," maybe it would be best to put it through Differential?

Angus Hollands (agoose77) changed the task status from Unknown Status to Resolved.Jun 19 2015, 9:17 PM
Angus Hollands (agoose77) claimed this task.