[Bf-committers] Feedback on BGE Collision API

Mitchell Stokes mogurijin at gmail.com
Sun Mar 20 02:39:17 CET 2011

Hello Blender devs,

I'm getting tired of not having access to collision information from
the BGE Python API, so I've decided to address this. I'm thinking a
collision would generate two collision events: one relative to each
object. This CollisionEvent object can contain information like hit
location, hit material and hit object (the material and object would
be what the object is hitting, remember, the events are relative to an

However, I'm uncertain as to how the user should access this events.
Other events like keyboard and mouse events are done by checking some
sort of list. If I were to do this for collision events, I'd keep a
list of collision events on each KX_GameObject. Making use of this
list would look something like this:

for ce in obj.collisions:
	if ce.name == "Bomb":

This looks good and is consistent with the rest of Blender. However,
I'm wondering if callbacks might be better? A callback example would
look something like:

def col_bomb(self, ce):
	if ce.object.name == "Bomb":


The callback example only has to be run once where as the list example
must be run constantly.

I've put some of these ideas in a brief wiki page[1].



[1] http://wiki.blender.org/index.php/User:Moguri/BGE_Collision_API_Proposal

More information about the Bf-committers mailing list