How to Create a FIRST PERSON Controller in Godot
Zenva
ACCESS the FULL COURSE here: https://academy.zenva.com/product/godot-game-development-mini-degree/?zva_src=youtube-godot-md
TRANSCRIPT
Welcome back, everyone. In this lesson, we're gonna begin to create our player object. This is going to be the player scene, which is gonna hold the player, it's collider and the camera. And from there we're gonna begin scripting the player. So to begin let's go up to Scene here and we're gonna create a new scene. It's gonna be of type kinematic body right here. Now this is very similar to the 2D kinematic body, which basically allows us to have some sort of physics interactions. It allows us to move along surfaces, collide with various different things. It's really good for characters and character controls pretty much. So I'm gonna rename this here to player. I'm gonna save it as, player.tsen and as a child of this node, we're gonna be creating, first of all, a collider. So we'll just look up a collision shape right here. And this is gonna be basically the sort of size of the player what they can collide with. So we'll set a shape here to be a new capsule shape right here. Right now, it's a bit odd. So what we're gonna do is we're gonna select the capsule shape. We're gonna set the radius to 0.5 and the height to 1.5 Now we need to rotate it and position it. So in the transform drop down here, we're gonna set the rotation degrees to 90 on the X. So it's vertical now and actually 1.25 on the Y translation, so it is just sitting above Y zero right here. Okay, great. So we got our player right here. Now what we need to do is add in the camera and the camera is going to be what we see through the player's eyes, we're gonna then be able to move this camera around with our mouse. So for the camera, I'm gonna right click on player, add child node and we're gonna add in a camera right here. By default, it's positioned down its feet. We're going to be a bit higher up so I'm gonna set the Y position of the camera here, the Y translation to be 1.5. We want it to actually be 2.5, so it is sitting just above the player's head right here and looking outwards. And in fact we can click on the preview button right here in the scene view to have a look through the camera and through the player's eyes.
Free Tutorials:
- Unity: https://gamedevacademy.org
- Phaser: https://phasertutorials.com
- Machine Learning: https://pythonmachinelearning.pro
- Web Dev: https://html5hive.org
- Android: https://androidkennel.org
- Swift: https://swiftludus.org
- VR: https://vrgamedevelopment.pro ... https://www.youtube.com/watch?v=mzsWfLsjG4w
145598329 Bytes