#1 FPS Movement: Let's Make a First Person Game in Unity!

#1 FPS Movement: Let's Make a First Person Game in Unity!

Natty GameDev

2 года назад

858,192 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Natty GameDev
Natty GameDev - 14.01.2022 00:19

Hey everyone!!
I have recently discovered that 2D vector composite has been changed slightly in later versions of Unity
In this tutorial I am using 2020.3.8f1..

In order to do the same thing.. you will need to change some of the properties of the Movement action...
So with the Movement action Selected:
- In the the Properties tab
- Change the 'Action Type' to Value
- Change the 'Control Type' to Vector 2
Now you will be able to right click on the Movement action and Add an Up/Down/Left/Right Composite!
Hope this helps! 😃

Also I left it out of the video but if anyone is having trouble implementing crouch and sprint, you need to define some extra properties for these at the top of your PlayerMotor script
lerpCrouch, crouching, sprinting -> bool
crouchTimer -> float

Ответить
Pab Dog
Pab Dog - 05.10.2023 07:55

i am using version 3.4.1 and th 2d vector thing does not come up 4 me

Ответить
Erik Bach
Erik Bach - 02.10.2023 22:59

i had some problems while doing it but with the help of comments everything works, very happy with ur tutorial m8

Ответить
xuanki
xuanki - 02.10.2023 17:58

Okay, so i know how to make my character start running and croaching, but what about dashing? How would be the code?

Ответить
DangOldRegularOld
DangOldRegularOld - 02.10.2023 07:07

I got sprint working but I want it to sprint on hold, not be toggle. Anyone have a fix?

Ответить
g o l d w e r d z
g o l d w e r d z - 30.09.2023 16:09

it says there is an error for OnFootActions and OnFoot

Ответить
A. H
A. H - 29.09.2023 15:36

Hello I like your all tutorials but in fps episode 2 you made the gate so can make in your tutorials Plz

Ответить
Nftalem Abel
Nftalem Abel - 28.09.2023 04:46

I encountered these two errors at the end of coding the Look function:

" error CS1061: 'Camera' does not contain a definition for 'Transform' and no accessible extension method 'Transform' accepting a first argument of type 'Camera' could be found (are you missing a using directive or an assembly reference?)"

and

"error CS1061: 'PlayerInput.OnFootActions' does not contain a definition for 'Look' and no accessible extension method 'Look' accepting a first argument of type 'PlayerInput.OnFootActions' could be found (are you missing a using directive or an assembly reference?)"

Can anyone help?

Ответить
the mad monkes
the mad monkes - 28.09.2023 02:08

this vid is a scam 2D vector dosent exiest

Ответить
traine2
traine2 - 27.09.2023 23:08

I did everything right but I cant look up or down

Ответить
ieatglue124
ieatglue124 - 27.09.2023 17:31

Hello, I have the PlayerMotor script but I get this error: Assets\Scripts\PlayerMotor.cs(10,13): error CS0246: The type or namespace name 'PlayerMotor' could not be found (are you missing a using directive or an assembly reference?)
here's my script;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class InputManager2 : MonoBehaviour
{
private PlayerInput playerInput;
private PlayerInput.OnFootActions onFoot;
private PlayerMotor motor; // Assuming you have a PlayerMotor2 script

// Start is called before the first frame update
void Awake()
{
playerInput = new PlayerInput();
onFoot = playerInput.OnFoot;
motor = GetComponent<PlayerMotor>(); // Make sure to use the correct PlayerMotor class
}

// Update is called once per frame
void FixedUpdate()
{
// Tell the player motor to move using the value from our movement action.
motor.ProcessMove(onFoot.Movement.ReadValue<Vector2>());
}

private void OnEnable()
{
onFoot.Enable();
}

private void OnDisable()
{
onFoot.Disable();
}
}

Ответить
Islati
Islati - 23.09.2023 15:56

It would be nice if you can explain the classes, methods, and API's you're using, why you're doing it, and a higher level understanding. I get it cause I've been doing this for a long time, and it's fairly straightforward, but it's a bit quick from a viewer perspective.

Ответить
Ficz
Ficz - 21.09.2023 20:36

The player motor part is not working for me

Ответить
teatimefox
teatimefox - 20.09.2023 01:26

The 2d vector input is not theare

Ответить
Klitiswoude
Klitiswoude - 19.09.2023 21:07

can someone help my camera lag when i crouch

Ответить
rithwik mishra
rithwik mishra - 19.09.2023 18:33

my jump is not working

Ответить
Sakshi Bodake
Sakshi Bodake - 18.09.2023 19:00

getting error the type name '.onfootactions' does not exist in the type 'playerinput'

Ответить
peace
peace - 17.09.2023 12:00

when i tried making the jump the player would be in the air until the player velocity was -2 and it was slow going down

Ответить
peace
peace - 17.09.2023 10:16

Great tutorial, I wasn't even making a shooting game

Ответить
Divine
Divine - 16.09.2023 21:02

i would like some help when i entered the inputmanager code i encountered this issue called Assets\Scripts\Inputmanager.cs(4,30): error CS1002: ; expected please reply for help

-TY

Ответить
Noodle
Noodle - 14.09.2023 19:00

I am. Stuck on the last line of code. look.ProcessLook(onFoot.Look.ReadValue<Vector2());
For some reason it’s telling me that “Look” has no previous definition, despite my code looking the same as his. Does anyone have any advice? 🧎

Ответить
dinopower studio
dinopower studio - 11.09.2023 18:34

my jumping dosent work

Ответить
Ishi Prashar
Ishi Prashar - 10.09.2023 21:04

my jump thing is not working, can anyone help

Ответить
Lakkibro47
Lakkibro47 - 10.09.2023 16:45

bro that import action is not showing in input folder I rechecked every thing but not showing that pls solve my problem i am beginner pls anyone tell me 😔😔

Ответить
Hamdi Houcem
Hamdi Houcem - 10.09.2023 02:33

i have a problem in the jump when i press space bar the player doesn't jumping btw my input action are right can someone help me to fix that

Ответить
Putze Prime
Putze Prime - 10.09.2023 02:18

Hi, very helpful tutorial, but I have one problem, And it seems that the character can jump indefinetly
How can I solve this, also, how can I make it to make the character be able to later have a doble jump hability?

Ответить
Rod Wenban
Rod Wenban - 09.09.2023 01:38

thankyou for this. Wondering what theme you are using in your VS editor?

Ответить
Bunyaad TV
Bunyaad TV - 08.09.2023 21:06

Anyone know a fix to The type 'PlayerInput' already contains a defination for 'OnFoot'

Ответить
Terraria Nezt
Terraria Nezt - 08.09.2023 16:31

this was so, so helpful, thank you! i had no idea how to make movement and combat in my game!

Ответить
TheRealJay. 77
TheRealJay. 77 - 07.09.2023 23:56

Guys, I have a problem with my characters movements, when I press ,,W" , my character starts flying and when I press ,,S" , my character comes back on the ground, please could someone help me?

Ответить
The only one
The only one - 04.09.2023 23:23

i got errors when i put in the first c# skript

Ответить
ImaBee
ImaBee - 04.09.2023 19:56

My code is saying that onfootActions does not exist in player input

Ответить
Maagi tuugi
Maagi tuugi - 04.09.2023 19:55

What kind of project tho? 3D? 2D?

Ответить
A. H
A. H - 04.09.2023 11:41

Sir your tutorial cool

Ответить
Dark Heart Rock band
Dark Heart Rock band - 04.09.2023 07:58

what are you using to set up the coding ?

Ответить
Samarth OMG
Samarth OMG - 03.09.2023 14:40

Hi the code in not working for me can you help me out

Ответить
PO5TUP
PO5TUP - 03.09.2023 06:46

for some reason once i press play Im unable to move the character with the move tool as he does to show that the character has no gravity. The player just keeps teleporting to where it started when i try to drag him up with the move tool.

Ответить
Duane Harden
Duane Harden - 02.09.2023 06:47

@Natty Creations so i opened my java script in fire fox so during the input manager part i cant edit/add code so i cant do a damn thing

Ответить
Duane Harden
Duane Harden - 02.09.2023 06:23

so i opened my java script in fire fox so during the input manager part i cant edit/add code so i cant do a damn thing

Ответить
Axe2024
Axe2024 - 01.09.2023 20:52

does anyone know why unity can't find Player Motor

Ответить
Therealkatakuri
Therealkatakuri - 01.09.2023 05:53

wheres the properties tab

Ответить
Neggo
Neggo - 01.09.2023 00:11

Seems like a lot of stuff changed, getting tons of error in the code, i think the formatting is different now.

Ответить
Ficklestein
Ficklestein - 31.08.2023 23:34

PlayerLook.cs:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerLook : MonoBehaviour
{
public Camera cam;
private float xRotation = 0f;

public float xSensitivity = 30f;
public float ySensitivity = 30f;

public void ProcessLook(Vector2 input)
{
float mouseX = input.x;
float mouseY = input.y;

xRotation -= (mouseY * Time.deltaTime) * ySensitivity;
xRotation = Mathf.Clamp(xRotation, -80f, 80f);

cam.transform.localRotation = Quaternion.Euler(xRotation, 0, 0);

transform.Rotate(Vector3.up * (mouseX * Time.deltaTime) * xSensitivity);
}
}

Ответить