About actioncamerapostion setting

hello, when i follow the course about actioncameraposition calculation in the code, i can’t understand why “+ (shootDir * -1)” is used? i tried to remove this code, it looks nothing changed.

Vector3 actionCameraPosition = shooterUnit.GetWorldPosition()
                                            + cameraCharacterHeight
                                            + shoulderOffset
                                            + (shootDir * -1);
1 Like

It should be setting the camera’s position one unit back from the shooter’s position…
We start with the position of the shooter
Then add the y element (the height we want the camera at
then the shoulder offset
and then finally the direction the character will be firing, but since we want to ensure that the shooting unit is in the shot, we move the camera BACK that direction… Shootdir is a line pointing to the victim, so the *-1 moves the position backwards along that line.

One unit isn’t a lot in terms of camera positioning… you might see a more drastic effect with shootdir * -10. Adjust the multiplier to taste.

2 Likes

thank you very much!

1 Like

Ur supposed to mark what helped your problem as the solution(first reply in this case), not you saying thank you, just a heads up :grin:

1 Like

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

Privacy & Terms