Only Follow Camera
Last updated
Last updated
Using SimpleFollow's Axis Masks property, you can easily create a 2D-like camera which tracks location only on specified axes. For example, if your character is jumping on platforms and you want to ignore x-axis movement, then you can set the first element of Axis Masks as zero. But it is noteworthy that Axis Masks is applied in world space.
Right click on Content Browser -> "Blueprint Class" -> create a "ECameraBase" class.
Open the class blueprint, select the "Camera Settings Component" and on the "Details" panel, expand the "ECamera" section.
Choose SimpleFollow for "Follow Component". You do not need to specify an aim component.
In SimpleFollow, set Follow Type to World Space, and set Follow Offset that you want to keep with the target actor. More importantly, set Axis Masks, masking out the axis that you would like the camera to ignore.
In the blueprint where you want to call this camera, invoke the "CallCamera" node and pass in the "Camera Class" and "Follow Target". It is mandatory to pass a location vector and a rotator to parameters SpawnLocation and SpawnRotation. The SpawnLocation should be the sum of target's location and the follow offset specified at Follow Offset. The SpawnRotation should be the direction you want the camera to look at. You can also specify "Blend Time", "Blend Func" and "Blend Exp" if you want smooth blending in. Ensure to disable Preserve State.