Detect vertex group under mouse

Hi all!

I’m trying to design a “simple” rubix game in BGE. But it seems that it isn’t that easy at all. So after searching a bit, I’ve found a solution with ridges to rotate the cube around.

So the idea now is, that on clicking on a cubix tile and then moving the mouse to a direction, the rotation that matches the mouse movement will be triggered.
But the thing that got me stuck until now is that I can’t get the “mouse over” sensor to work properly.
My first try was to have 25 objects with a mouse over sensor that is connected to a python controller. This script sets a property on an empty that stores the object the mouse is over. On a click an mouse click sensor on this object checks which object is selected and triggers a state like “mouse down” and then waiting for mouse movement. That’s the idea…BUT it already fails with the mouse over sensors. Every time I move the mouse from one to an other object, the object that isn’t hovered by the mouse anymore fires a second pulse and overwrites my property.
The second try now is to just have one object with different vertex groups. But now I can’t find a method to “rayCast” or detect over which vertex group the mouse is.

So does have anyone an idea to elegantly solve this problem?

I’ve attached a .blend file I’ve found here in the forum, in case you wan’t to test some coding.



rubik_cube.blend (460 KB)