Understanding Action Camera shoulder positioning

Trying to understand the maths being done here to position the camera to the unit’s right shoulder.

How does Quaternion.Euler(0, 90f, 0) * shootDir * shoulderOffsetAmount actually offset the shoulder amount distance ? I’m mostly confused because i normally use Quaternion.Euler(0, 90f, 0) to set rotations of my objects.

1 Like

We are taking the direction to the target (shootDir), rotating it by 90 degrees on the Y axis (to the right) and moving shoulderOffsetAmount in that direction to get the point where the camera should be sitting.

If we changed it to Quaternion.Euler(0, -90f, 0) it would move to the left.

1 Like

The shoulder is off to the side, but in order to get the side you need to base it on where the unit is aiming at. So in order to get the shoulder rotation you need to to rotate relative to the shoot direction that’s why you multiply by the direction.
If you don’t multiply by the shootDir then you just get a fixed vector regardless of where the unit is aiming.

If you’re shooting forward (0,0,1) then you want to rotate that vector 90º to get (1,0,0).
If you’re shooting right (1,0,0) then you want to rotate that vector 90º to get (0,0,-1)

1 Like

Thanks for the examples @CodeMonkey ! and @bixarrio !

Interesting, so multiplying the quaternion euler against a vector will basically move the point on a rotation and in this case, its the Y axis.


image

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms