BGE physics: When colliding, report first contact point to Python
authorSybren A. Stüvel <sybren@stuvel.eu>
Thu, 5 Feb 2015 08:39:53 +0000 (09:39 +0100)
committerSybren A. Stüvel <sybren@stuvel.eu>
Sun, 8 Feb 2015 14:52:13 +0000 (15:52 +0100)
commitdd65a44c9a192d62f7661090682ee0dc99fb0491
tree38a4a150113aca9c09de3851052597ee0f8bdfb9
parent51b645a655eb41c5b73d8487ee7df9ba99fc692b
BGE physics: When colliding, report first contact point to Python

This patch adds two parameters to the functions in the
collisionCallbacks list. The callback function should thus be like
this:

```
def on_colliding(other, point, normal):
    print("Colliding with %s at %s with normal %s" % (other, point, normal))

game_ob.collisionCallbacks.append(on_colliding)
```

The `point` parameter will contain the collision point in world
coordinates on the current object, and the `normal` contains the
surface normal at the collision point.

The callback functions are checked for the number of arguments
`co_argcount`. The new `point` and `normal` arguments are only passed
when `co_argcount > 1` or when `co_argcount` cannot be determined.

Reviewers: brita_, campbellbarton

Subscribers: sergey, sybren, agoose77

Projects: #game_physics

Differential Revision: https://developer.blender.org/D926
doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_TouchEventManager.cpp
source/gameengine/Ketsji/KX_TouchEventManager.h
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp