Setting up and moving the CharacterBody in 3D
In this recipe, we set up a third-person 3D player character prototype with the new CharacterBody3D node. We will create a scene with ground and the player prototype, for which we use a CapsuleMesh with a BoxMesh for the gun. We place a camera behind the player for a third-person perspective. We add to the CharacterBody3D node the new CharacterBody3D: Basic Movement template found in the Template section when creating a new script.
Getting ready
For this recipe, click the + sign to the right of the Platform2D scene we just completed to add a new scene. In the Scene tab, click 3D Scene. Right-click on Node3D and select Rename in the drop-down list and rename it World
. Click on the word Scene in the main menu next to Project, then select Save Scene As and name it Ground3D.
How to do it…
Let’s create a world scene with ground and a player with a camera following the player:
- Left-click the three vertical dots...