You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
0 Hrs
54 Min
19 Seg

Creación del controlador de nuestro FPS

11/20
Resources

How to create a character in Unity?

In the exciting world of video game development, Unity is one of the most popular tools. Building scenarios and characters is an essential task. For our video game, we have created a character from scratch. Don't worry too much if it seems complicated at first; with practice and patience, you will master each step.

  • Using Unity and its elements:
  • Start by saving your project frequently. This is one of the best practices when working on software projects.
  • Create a new 3D object, such as a capsule, which will serve as our character. Make sure you position it correctly in your game's scenario.

Why use a capsule as a character?

You may wonder why we use a simple capsule instead of a more detailed character. In a First Person Shooter game, the player does not see the character; he sees the world through "his eyes". Examples such as Master Chief in Halo or Doom Guy illustrate this idea. The capsule acts as a simple container for important elements, such as the collider, which is essential for detecting collisions and taking damage.

How to improve the visual experience?

Within Unity, you can adjust different parameters to improve the user experience. Here we leave you with a couple of key recommendations:

  • Adjust the camera:

  • Make the main camera a child element of the pod. This is important to simulate the player's perspective within the game.

  • Reset the camera positions and rotations to zero to align the view with the character.

  • Field of View (FOV):

  • Modifies the FOV of the camera to decide how much of the world will be visible. A FOV of 25 is ideal, giving you a wide view of your environment in the game.

How to create a script file in Unity?

To add logic to our video game, you must work with scripts. Here's how to do it:

  1. Creating folders and scripts:
  • In the assets folder of your project, create a new folder called "scripts".
  • Inside this folder, generate a new script called "Mira", which will control the mouse view in the game.
  1. Using Visual Studio Code:
  • Open the script in Visual Studio Code. If this is your first time using this editor, you will need to log in.
  • Visual Studio Code is the default editor in Unity, and an excellent tool for beginners.
  1. Understanding the script structure:
  • Unity provides two essential methods: Start and Update.
    • Start: executed at startup, useful for initializing configurations.
    • Update: runs at every frame per second. This is where the real magic happens, such as camera controls and motion detectors.

Example code in C

public class Mira : MonoBehaviour { void Start() { // Execute at start of game }
 void Update() { // Execute every frame }}

How to handle camera movements with the mouse?

The player's interaction with the environment is crucial. Here we explain how to move the camera using the mouse.

  • X and Y axis:
  • Our approach will be to map the mouse movements to these two axes. The vertical axis will allow you to look up or down, while the horizontal axis will allow you to turn the view sideways.

By following these steps, you will be able to build a playable terrain in Unity. Keep exploring and experimenting, as each practice will bring you closer to becoming an expert in game design. Don't get discouraged and keep learning!

Contributions 14

Questions 3

Sort by:

Want to see more contributions, questions and answers from the community?

Si nuestro juego está corriendo a 30 cuadros por segundo el código dentro del metodo Update se va ejecutar 30 veces.
.
Mas cuadros por segundo significa mayor fluidez dentro del juego.
.
Cada cuadro se dibuja en el GPU con ayuda del CPU.
El CPU le manda instrucciones al GPU de lo que debe graficar y el GPU se encarga de mostrar las imágenes, luego nuestro monitor nos muestra está sucesión de imágenes y eso es lo que nos da la experiencia de estar viendo algo vivo.

tengo el pressentimiento de que mi juego va a ir a un frame por minuto jajaa

Como avanza poco a poco… Estoy muy contento. En breve se viene el querido C#

Muy bueno el curso, excelente.

Para aquellos que no quieren pagar o descargar la prueba de Visual Studio, pueden descargar VS Code totalmente gratis y no llega ni a los 100 megas de peso, y dotNet como compilador.

Lo que explico el profesor sobre MonoBehaviour quiere decir que por cada cosa que se pueda hacer en el juego se tiene que hacer un script?

Genial

Ricardocelis: muchos juegos modernos estan a 30 fps por que el hardware no les permite mas velocidad.
Yo by like jugando a 200 fps xd

Clave activación visual studio code:
Enterprise: BF8Y8-GN2QH-T84XB-QVY3B-RC4DF
Profesional: NYWVH-HT4XC-R2WYW-9Y3CM-X4V3Y

Chicos y chicas encontré el error básicamente delta time hay que ponerlo en mayúscula la T(deltaTime) XD nos estaba rompiendo la cabeza ese error
Ayuda con el error por favor :(

La ventaja es que aqui en platzi también podemos tomar el curso para entender y crear el codigo