Mouse Over Any sensor doesn't work on armatured objects

In my scene, I have a scrollbar to work with and I was trying to use bones to scale the scrollbar.

It looks the way I needed, but when I tried to interact with it doesn’t work. For curiosity I disabled the Armature modifier and it goes back to normal.

How can I use pivot points to scale objects and also it’s physics?

The scrollbar looks like this:
image

Turn on the physics visualization option before launching the game and you will see that your Armature’s collision box shape will depend on the position of the bones before your launch de game.

And in your case, the collision box will roughly correspond to the area covered by the distances separating the bones.

What are you trying to achieve at the end ? Because if it’s just a matter about scaling objects, well, object’s scale can be keyframed in an action and played during game.

But i feel like you are more wanting to simply drag the scrollbars along with your mouse cursor … riJust like Windows in an OS ? Right ?

If yes, i can give you the python code for that but it’s basically something like


import bge


cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()
cam = scene.active_camera

# mouse sensor
mouse = own.sensors['Mouse']

# get the mouse
my_mouse = bge.logic.mouse
mouse_pos = my_mouse.position

vec = cam.worldPosition - cam.getScreenVect(*my_mouse.position) * cam.worldPosition.z


# scrollbars
barA = scene.objects['Cube']
barB = scene.objects['Cube.001']

# drag each bars on a specific axis
if mouse.hitObject == barA :  barA.worldPosition.x = vec[0]
if mouse.hitObject == barB :  barB.worldPosition.y = vec[1]

I did something similar in my game , but just like in Windows , i strongly recommend to couple the “Mouse over” with a left click to start the drag … but stop the drag only when click release EVEN if the cursor is no longer on the bar

What I want is to have 4 pivot points to control the scalings automatically. In this case I attached the slider hitbox to the bone, moving accordingly and proportionaly to the window’s edge.

If I decide to change the scale of the slider window I need to move every slider and its elements in order to be organized, is much easier to just move a pivot point that all elements are attached to. But not only that, the bone needs to be capable of also change the slider length as shown below:

2023-05-25 18-20-35.mkv (1.3 MB)