calulating if the camera is over the left or right shoulder.

Hi

I’m trying to get the player character to rotate so he faces the same way as the camera. I want to use animation so it look natural. I have programmed the animation however I want to play the turn left if he is turning eft and turn right if he is turning right.

My problem is I cannot find a good way to calculate if the camera is over the left or right shoulder.

Does anyone have a way of doing this?

You could use cross product but if the camera is attached and relative to the player:

From the top: Right | Centre | Left

Would that work?

Did you mean relative Rotation? I cannot get that to work.

No, relative location. If the camera is offset to the left, it’s -Y, if it’s on the right, it’s +Y. We don’t care where it’s pointing.

Image from Gyazo

This would work well (because it’s the simplest solution) if you have a camera attached and relative to the player.

Ahh I see the problem. I’m using the standard third person template and the not offset by relative location it is on a camera boom and rotates with the mouse.

I’m using the standard third person
template

Same here, that’s exactly what I’m using. I’m checking if the springarm is on the left / right.

If not by offsetting left / right - how are you actually achieving the shoulder camera then?

Maybe I’ll clarify what I mean. If I wanted a simple shoulder cam switch on a revolving springarm, I’d probably:

Rather than the boom, offset the camera.

But perhaps I’m misunderstanding your setup completely.

Yes maybe I have confused it.

What I really want is some method of querying if the camera is rotated to the left or right of the character. That way I would be able to select the animation to play.

Ah, I see. You do need cross product then:

See if this is enough.

Excellent works like a dream Thanks