Basic Camera Setup1 The Camera need many specific Child Transform to be attach to them. If you use UnitSetupEditor explained in ReadMePDF_V2_3_02SetUpUnit, these will be automatically setup for you. However, this document will also explain how to setup manually. If the setup is not done correctly or you choose not to do it at all, CameraControl.cs contain automatic fix and Instantiate code If you do not use UnitSetupEditor, The Minimum that you need to do is, Create EmptyGameObject, name it CameraRoot , and attach CameraControl.cs script to it. Current Position Target Position Blend Position Last Updated in 2.3
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Basic Camera Setup1
The Camera need many specific Child Transform to be attach to them. If you use UnitSetupEditor explained in ReadMePDF_V2_3_02SetUpUnit, these will be
automatically setup for you. However, this document will also explain how to setup manually.
If the setup is not done correctly or you choose not to do it at all, CameraControl.cs contain automatic fix and Instantiate code If you do not use UnitSetupEditor, The Minimum that you need to do is, Create EmptyGameObject, name it CameraRoot , and attach CameraControl.cs script to it.
Current Position
Target Position
Blend Position
Last Updated in 2.3
Basic Camera Setup2
3rd Person Camera utilize Blend to Target Transform Algorithm
1. Create Empty GameObject and Name it CameraRoot, then parent the following to this 2. AimCamPos_Crouch, the Transform Location of where you want the camera to blend to,
when the Character is Crouching and Aiming 3. AimCamPos_Stand, similar to AimCamPos_Crouch, when Unit is Standing 4. AimCamPos_Laying, similar to AimCamPos_Crouch, when Unit is Laying 5. CamTargetTransform, The Actual target Transform of where the Camera will blend to. 6. Main Camera 7. PlayerAimIK, use for Aiming related motions.
When Aiming, this will be where the character will face to. Can be use for locking on to Enemy Target.
Current Position
Target Position
Blend Position
Last Updated in 2.3
Basic Camera Setup3
1. In Camera Root, Attach CameraControl.cs script 2. Attach your Character to UnitTransform slot
1. If Unit is not attached, the code will automatically find a GameObject with “Unit” tag to it. You could tag your Player unit as a safety device
3. Turn on ConstrainPositionToUnit
1. This will make the Camera follow Character around 2. If you want the Camera to remain Stationary while Character move, turn this off
CameraRoot
Unit
Last Updated in 2.3
Basic Camera Setup4
In PlayerAimIK, Add follwing scripts 1. GizmoSphere – Will display where the Target is in Editor 2. AimIKLocation Script – Will Calculate where the Transform is needed to be
1. Recoil is use for FireArm weapons 2. GetRaycastHit
1. Turn this on will place the Transform on where the RayCast hit the object 2. If off, will place Transform at MaxAimDistance from the Camera
3. MaxAimDistance – The Maximum Distance that Transform will be place from Camera 1. This could be use to limit Distance to Enemy
4. To Avoid Raycast hitting Player Character, detailed setup instruction is in the code
AimIK
Camera Unit
MaxA
imD
istance
Raycast Hit Collider
Last Updated in 2.3
Camera Design Concept
1. Distance – Horizontal Distance of Camera from CameraRoot 2. Height – Vertical Distance of Camera from CameraRoot 3. Focus – Where the Camera will Look at relative to CameraRoot
By Default, Moving Mouse Vertically will Control Height and
Horizontally will Rotate CameraRoot
CameraRoot
Focus
Camera
Heigh
t
Distance
Last Updated in 2.3
Camera Height
1. Val is the Current Height of Camera from CameraRoot 2. Min is the Minimum Clamp Value of Val 3. Max is the Maximum Clamp Value of Val
Camera
Heigh
t
Last Updated in 2.3
Val
Max
Min
Camera Distance
1. When in Constant Mode, the Horizontal Distance of Camera from CameraRoot is always Val 2. When in FacingAngle Mode,
Last Updated in 2.3
Val
S
N
E W
The Distance will be blended depending on where the Unit is heading perpendicular to the Camera, FaceFront => Target Distance when the Unit Face N FaceSide => Target Distance when the Unit Face W or E FaceBack => Target Distance when the Unit Face S BlendSpeed determine how fast will the Camera Blend **Number below 1.0f is known to have problem**
Camera Focus
Camera has 3 Focus Modes
Last Updated in 2.3
CameraRoot
Offset Position
Heigh
t
Distance
Using Value from FaceFront, Camera will focus at the Front of where the Character is facing.
FocusPlayer Mode
S
N
E W
Distance
Camera Focus
Last Updated in 2.3
FocusCamForward Mode
S
N
E W
Using Value from FaceFront, Regardless of where the character is Facing, The Camera will always Focus at a distance away from itself
Offset Position
Heigh
t
Distance
Camera Focus
Last Updated in 2.3
FocusUnitForward Mode
Using Value from FaceFront, FaceSide, and FaceBack, Depending on where the character is Facing, The Camera will blend focus distance accordingly
S
N
E W
Face Side Distance
S
N
E W
Face Fron
t Distan
ce
S
N
E W
Face BackD
istance
Camera Obstruct
Last Updated in 2.301
If any Platform Object within Layer “Platform” is placed between Focus and Camera,
The Following can be done. 1. Do Nothing 2. Render the Object Half Visible 3. Move Camera closer 4. Do Both 2&3
Camera Obstruct
Last Updated in 2.301
By Default, This will only work with Objects that are place in Platform Layer
Check which Layer you want the Platforms to be in, Then edit LAYERNUM accordingly
Camera Obstruct
Last Updated in 2.301
Shader inside Transparent Shader Slot will be use to replace Object’s Shader. If it is empty, Tranparent/Diffuse will be load by Default via Script
Half Visible Mode
To change Default Shader, edit the following Line inside CameraControl.cs
Camera Obstruct
Last Updated in 2.301
The Camera will move Closer toward Focus. Depending on Camera Angle and Platform Shape, the Camera might not go through The