Character Looking At Curser

So how do i make the character always look at the mouse, by that meaning the head rotating to look at the mouse and has limitations to rotation. I got my mesh in separated parts such as head and body. I have had no luck with bone tracking, although i might not be doing something right. Any suggestions?

mouse over any or ray---------python

import bge
cont=bge.logic.getCurrentController()
own=cont.owner
sens=cont.sensors['MouseOver']
if 'Placed' not in own:
    
    own['Placed']=scene.objects['target']
else:
    p=own['Placed']
    if sens.positive:
        p.worldPosition=sens.hitPosition




then IK target to the “placed” item

(placed item is already in scene)

set bone limits in IK tab in pose

Attachments

IkTractToPlacedByMouse.blend (451 KB)

thank you for the help!

No problem, I added a file to the response

also

I forgot

scene=bge.logic.getCurrentScene()