Why not just set the follow/lookAt property for actioncam?

Wouldnt it be much easier to just set the cams Follow and LookAt properties like so:

                    var cam = actionCameraObject.GetComponent<CinemachineVirtualCamera>();

                    cam.Follow = shootAction.GetUnit().transform;
                    cam.LookAt = shootAction.GetTarget().transform;
                    actionCameraObject.SetActive(true);

Sure you could take that approach, although it wouldn’t be as easy as that. With what you have there the camera would be placed on the shooters feet looking at the targets feet which is not the intended goal.

So if you take that approach you still need to do all the math to place the camera offset on the shooters shoulder and look at the targets body.

1 Like

My solution for that was to just set the offset in the ActionCamera

But the offset there is fixed, it has no relation to the rotation of the Unit.

If you put the values where it looks correct on the shooters right shoulder when shooting right, it will not look correct when shooting forward since it will use the exact same offset

Only if you change the camera type to Third Person, that way it might follow the rotation.

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

Privacy & Terms