2.6 KiB
3rd Person Follow
This Virtual Camera Body algorithm is intended for use to implement a 3rd-person or 1st person camera. The algorithm places the camera on a mini-rig with 3 pivot points:
Pivot point 1 is the origin, which is the Follow target's position. When the target rotates horizontally, the rig rotates with it around this point.
Pivot point 2 is the shoulder, and by default is offset to one side of Pivot Point 1, to create an over-the-shoulder follow position. To make a 1st-person camera, set this offset to 0, or to whatever will give an appropriate 1st-person effect given your Follow target's position. Vertical rotations of the Follow target are transferred here, so the rig rotates horizontally about the origin, and vertically about the shoulder.
Pivot point 3 is the hand. This is by default offset from the shoulder, so that vertical rotations will keep the character nicely positioned on the screen. For 1st-person cameras, this can be set to 0.
Finally, the camera is positioned behind the hand, at a specifiable distance from it. The camera's rotation will always be parallel to the Follow target's rotation, but positioned behind the hand.
The camera's position and rotation are controlled by moving and rotating the Follow target, not by independent camera controls.
The 3rd-person Follow module has a built-in collision resolution system, so that if the target moves close to an obstacle, the camera position will be adjusted so that it will never be inside an obstacle.
Properties:
Property: | Function: | |
---|---|---|
Damping | How responsively the camera tracks the target. Each axis (camera-local) can have its own setting. Value is the approximate time it takes the camera to catch up to the target's new position. Smaller values give a more rigid effect, larger values give a squishier one | |
Shoulder Offset | Position of the shoulder pivot relative to the Follow target origin. This offset is in target-local space. | |
Vertical Arm Length | Vertical offset of the hand in relation to the shoulder. Arm length will affect the follow target's screen position when the camera rotates vertically. | |
Camera Side | Specifies which shoulder (left, right, or in-between) the camera is on. | |
Camera Distance | How far behind the hand the camera will be placed. | |
Camera Collision Filter | Camera will avoid obstacles on these layers. | |
Ignore Tag | Obstacles with this tag will be ignored. It is a good idea to set this field to the target's tag. | |
Camera Radius | Specifies how close the camera can get to obstacles. |