Realtime texture paint on collision works on Upbge 0.2.4, needs update to Upbge 0.3 [Solved]

Hi,
I modified the mouse controlled realtime texture paint blend file i found here in a thread to work on collision of an object, in this case it is the CubeHit object.

It draws a heart on the torus when the CubeHit object hits the torus.

It works fine on upbge 0.2.4 but i need to update it to the latest upbge 0.3.

This technique is the best and accurate i have found to draw wounds in a battle when the weapon hits the body.

Any help will be appreciated as i need this to continue my game to the newest upbge which is simply GREAT!!!

Blend file is here:
You have to download the heart.png and wall.png image and put in the blend folder:
heart


TexPaint_onCollision00.blend (501.1 KB)

Congratulations to all working on this.

There are several errors.
One of them is line 38 at KDtree.py
Replace
local = Hit.worldOrientation.inverted() * local
by
local = Hit.worldOrientation.inverted() @ local

I will investigate more.

That @ instead of * solved the problem. Thank you very much!