DModelPanel SetLookAt cursor?

Hello, I was just wondering how to get a DModelPanel (playermodel in this case) to follow your cursor with it’s head. (look where you are pointing)

I’ve messed around with SetLookAt but I was only able to get non-moving positions.

Any help would be great, Thank you.

There are a couples ways you could go about this.

I’d map the width and height of the panel to the rotation of the head.
This is a quick and dirty method that’s not very accurate.

Another way is to use line plane intersection and find the exact position the head should be looking, then rotate the head.

I think vexx has the right idea, since most models that can look at things will have pose parameters for pointing the head at the mouse, and you could map the range of the parameter against the control.

If your goal is to have something look at what you have the mouse pointing at ( eg, a lever or prop ), then the second suggestion would be the route you would need to take.