Using the Capitan Blackclaw Avatar[edit | edit source]
- 1. If the Capitan Blackclaw Avatar is not already present in the scene, delete any children in the “Avatar” folder in the Project Hierarchy. Using the Library Panel, click on the Filters tab and select "Avatar". Find the "Capitan Blackclaw" object and drag it into the Project Hierarchy under “Avatar”.
- 2. Select the “Capitan Blackclaw” object in the Project Hierarchy and view its Components tab. Click the gear icon on the “Capitan Blackclaw” script to view its code.
- 3. For a sidescrolling game, the Avatar should only move left, right, up, and down in a 2-Dimensional space. To implement this, we need to make sure that Blackclaw can only move along the horizontal and vertical axes, and that left and right movement is controlled by the A and D keys. Scroll down to the HandleInput() method in the “Capitan Blackclaw” script. Replace the last three lines of code in HandleInput() with the following:
float horizontalInput = 0;
float verticalInput = EndlessInput.GetAxis(KeyboardAxis.AD) + EndlessInput.GetAxis(XBoxOneAxis.Left_Joystick_X);
_moveInput = new Vector2(horizontalInput, verticalInput);
- 4. On the “Capitan Blackclaw”'s Components tab, scroll down to the “MOVEMENT” section and click on the “Orientation Mode” dropdown. Select the “TO_WORLD” option. Under “Constraints”, check the “X” box for “Freeze Position” and the “X” and “Z” boxes for “Freeze Rotation”.
- 5. Under “Capitan Blackclaw”, locate and delete the “Platformer Camera Rig” child object. In the Library, search “Third Person Camera” and drag the “Third Person Camera Rig” into the Project Hierarchy as a child of the “Capitan Blackclaw”.
- 6. Select the “Third Person Camera Rig” and view its Components tab. Drag the “Capitan Blackclaw” object from the Project Hierarchy into the “Camera Target” field. Check the box for “Default Camera State Definition”.
- 7. On the "Third Person Camera Rig", open the "Settings" dropdown. Set the "Offset From Target" values to 85 for X, 2 for Y, and 0 for Z. In the field for "Rotation Smoothing", set the value to 1. In the field for "Position Smoothing", set the value to 0.1. In the field for "Camera FOV", set the value to 10.
- 8. You may now be able to play test the movement and camera view of the Avatar in-game. However, you may need to adjust the properties of the camera in its Components to get the view you want. For help adjusting camera properties, scroll down to the “Adjusting the Camera” section below.