Point of collision

Hi, I need help detecting the point of collision between 2 objects. One of the objects is a plane and the other is a sphere.
Once the sphere touches the plane I use the collision sensor to detect the object that it collided with, but I want to know the point where they made contact. Since the physics visualization shows the point of contact I’m sure its available somewhere but where?

collision callbacks will get object, point, and normal.

What the frack!? When were these implemented?! And why didn’t I hear about it?! xD
I’ve been eagerly awaiting for this : D

atleast since 2.74, the version i use. ill post a code sample later since it can be tricky at first.

how well it works? i dont know, never really checked.

I have used the callbacks, they are handy.

https://docs.blender.org/api/blender_python_api_2_76_1/bge.types.KX_GameObject.html#bge.types.KX_GameObject.collisionCallbacks


class COLLISION_CALLBACK:

	def __init__(self, OBJECT):

		self.owner = OBJECT

		self.collision = (None,None,None)

		self.owner.collisionCallbacks.append(self.COLCB)

	def COLCB(self, OBJ, PNT, NRM):

		self.collision = (OBJ, PNT, NRM)

def MODULE():

	SCENE = logic.getCurrentScene()
	OWNER = logic.getCurrentController().owner

	## Startup ##
	COL = OWNER.get("COLCB", None)

	if COL == None:
		OWNER["COLCB"] = COLLISION_CALLBACK(OWNER)
		return

	## Get Collision ##
	if OWNER["COLCB"].collision[0] != None:
		print(OWNER["COLCB"].collision)



What would be very useful, is to get the impact vector per frame per hitobject, per contact.

How does it currently work?

PS: Deadalus_MDW: Is there an API for this somewhere? I can’t seem to find the documentation : S

PPS: Tried to get it to work, but I’ve no idea what “base” means on line 26?

https://docs.blender.org/api/blender_python_api_2_76_1/bge.types.KX_GameObject.html#bge.types.KX_GameObject.collisionCallbacks

And no, we cant gather the impact per hitObject,

We can’t even seen the magnitudes of the collision without a bunch of math.

oops, just delete the “base.” part of it. i just ripped that from my setup. will edit post.

basically, you need to append a function reference into the callbacks list. i only used a class so you could easily catch the results.

https://docs.blender.org/api/2.78b/bge.types.KX_GameObject.html#bge.types.KX_GameObject.collisionCallbacks