WALL JUMPING & CAMERA EFFECTS - Unity Tutorial
HTML-код
- Опубликовано: 1 апр 2022
- WALL JUMPING & CAMERA EFFECTS - Unity Tutorial
As a continuation to my wall run tutorial last week, I'm now going to show you how to add wall jumping and smooth camera effects (fov change and cam tilt).
If this tutorial has helped you in any way, I would really appreciate it if you leave a like in return. And you can also subscribe to this channel if you want to see more tutorials like this one.
Links:
➤ DOWNLOAD the WALLRUNNING SCRIPT: www.mediafire.com/file/0emksz...
➤ DOWNLOAD the CAM SCRIPT: www.mediafire.com/file/aqsi81...
➤ GET the PLAYER MOVEMENT SCRIPT: • FIRST PERSON MOVEMENT ...
➤ DOWNLOAD the PROJECT (in the free-code-dave channel): / discord
➤ DON'T CLICK: bit.ly/2VcrDZt
➡️ Get Access to my full MOVEMENT LAB!➡️
➤ Trailer: • MOVEMENT LAB - Unity P...
🏹 Get Access to my RANGED COMBAT LAB!🏹
➤ Trailer: • RANGED COMBAT LAB - Un...
Other interesting videos :D
➤ THROWING Grenades, Knives and Other Objects - Unity Tutorial): • THROWING Grenades, Kni...
➤ FULL 3D ENEMY AI in 6 MINUTES! || Unity Tutorial: • FULL 3D ENEMY AI in 6 ...
Support me on Patreon:
➤ / davegamedevelopment
#UnityMovement #UnityWallrunning #UnityTutorial
If anyone is having troubles with the player, re-attaching themselves to the same wall after the wallTimer finishes(due to the exitWallTime not being long enough), you can add "if(wallLeft || wallRight) {exitWallTimer = exitWallTime}" in the if loop, where you count down the exitWallTimer.
I love this movement tutorial series so much!!! Very clean explanation and all movements are cool~ keep it up ❤
Thanks a lot! Glad you like it :D
Respawn: *Doesn't make Titanfall 3*
Indie devs: "Fine, I'll do it myself."
Haha :D
I litterqlly thought this while following the tutorial
At first i thought this movement was not better but eventually, it is getting way better... Can't wait for the grappling tutorial xD
Haha, thanks! :D
Love you . This is awesome
Again another good tutorial
Thanks! :D
YES YES YES! I'm probbably gonna use this info for my new game :D :D :D I was looking for this!!
Glad I could help! :D
that's a really nice tutorial right there
Thanks a lot!
Thank you for everything!
No problem! Thanks for watching :D
thank you man for uploading this
No problem, glad you like it!
@@davegamedevelopment for the wall run script, what did you put what is wall and what is ground as they are mixed. is it just wall and ground layermasks?
@@biscuittinx9203 Yes, I made it simple and just selected both.
I would like to ask if you could show us how you go about using probuilder and progrids.
Maybe a few examples of basic modeling? (ie.: scale, extrude, inset, loopcuts, holes, etc)
Finally your again here!!
Yes :D
I can’t wait for climbing
Var fun = Dave + unity
:D
first like i love your tutorials
Thanks a lot! :D
To avoid double jump on the same wall, remember the last wall normal and prevent jumping if the next normal is near the previous normal, like below an normal angle of 30 degrees, for example. This will feel more realistinc, as you can't really wall jump on the same normal angle.
Thanks for sharing!
Do you have the code to implement that?
plz help, when I wall jump theres only upward force and no side force
How?!
For people having trouble sticking to the wall and making it so you can wall run create a new physics material then set the Dynamic Friction to 0 Static Friction to 0 Bounciness to 0 Friction Combine to Minimum and Bounce Combine to Average :) great vid btw I was just finding a base movement tutorial and now im following the whole series
Thank you so much!
My raycast isn't even work every time I try to get stick in the wall the state doesn't change, do you know why?
Hey Dave in all your wallruning tutorial you use a / d to get the position of the player how can we got this by for example the camera angle? Thanks also again a nice tutorial 👍
Thanks
No problem!
I'M LEARNING BRUH!!!!
nice video! can u make a tutorial about adding stamina (with ui, and sliding will increase stamina losing)?
Hi, can you please clarify: Does your Patreon contain all of these tutorials already? Or are these new? I'd love to subscribe to the Patreon if it has more of these tutorials starting from a scratch project. This is amazingly cool work.
The MovementLab project contains everything I've showed in tutorials and even more. I also update it every month and add new abilities / overwork existing ones :D
Thanks for the amazing tutorial!!
I just have a question regarding the movement in this series .
how can i change direction mid Air towards mouse direction ?
could not find any help online!
i'll appreciate the help T_T
make sure your air multiplier isn't set to zero
Are you planning to release a tutorial on the grappling you have done for the movement lab promo video?
Probably yes, can't give an exact date though :D
i also have another problem where sometimes based on the wall's normals, the force applied on the jump is less than what i set it to be
Amazing tutorial but when I try to jump on the wall sometimes it does not let me get onto the wall
excellent tutorial series, thank you for uploading. I have found that, during a wallrun, my camera view clips through my walls, showing whats on the other side. Any ideas how to avoid this?
edit the clipping planes on your main camera to something like 0.025. it works for me
Hello, is all of this functionality as well as additional stuff that you might cover in future videos already implemented in the full project with learning plan that's available on your patreon?
I'd like to learn and see how all of this works.
Yes, everything already implemented + I'm updating it every month :D
your voices remind me to Brackeys channel
Just What I Want ..
Glad you like it!
hi i know this is thing from other video but i have a problem my speed state isnt changing when i crouch, do you have any ideas how to fix this
I have a problem where on two faces of a wall, my wallrunning works, however on the other two faces one of them applies an upwards force and the other one a downward force. Any Ideas?
I followed this tutorial exact and even downloaded you code but when I try to wall jump it just drops me of the wall (the jump doesn't actually work) but it turns of the wall running and that. I've found it's because of the exitingWall bool as when I allow jumping when exiting wall is false (!exitingWall) this happens but when I take it away it works. I know the function runs as I used debug.log in the funtion and it prints something but it won't work with the exitingWall. Please Help!!
i followed this tutorial series but my camera clips through the wall. i reduced the clipping planes and it worked but now i can see part of my player when im sliding. anyone have a fix?
How to add footstep sound whenever walking and sprinting ?
Tq even though im not a game maker lol
Haha :D
when i wall run and my camera tilts, part of my camera goes through the wall, as well as everytime i do so, a scene called DontDestroyOnLoad appears
hey im having trouble with dotween it gives me a error message of assets/plugins/demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs does anyone know how to fix this?
How would you implement a corner mantle? If your player character got to a corner and wanted to climb it or h9ld onto it like titanfall 2/apex legends
That would be an animation tho, not rigidbody movement right? In that case you can do that many ways via blend trees, you just need a parameter that sets the animation. That parameter could be a float that is equal to the y distance of the next corner, if the float is smaller than the trigger level the animation will occur. I'm not sure if that would work, but its worth a try
Hey for people having the same problem as me as if the character not rotating anymore use another script to make the player rotate while looking
here's what i used(might have some stuff that are useless)
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
public class PlayerRotate : MonoBehaviour
{
public Transform playerObject;
[Header("References")]
public PlayerCam pm;
float xRotation;
public float sensX;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX;
playerObject.Rotate(Vector3.up * mouseX);
}
}
Hey Ive been following along with all of your tutorials and my characters controller is finished now and amazing! I have a problem with the wall jump though. Every time I walljump, rather than jumping off the wall and falling, my player floats up into the air. Do you have any suggestions on how I can fix this? Please.
me too!
You still have that problem ?
Try finding at the exit of the wallrun function set rb.useGravity = true;
all you need to do is tick the "Use Gravity" box then it should work :)
use
rb.useGravity = true;
pm.wallrunning = false;
in your StopWallRun() function and it should be solved. And make sure you are calling the function
Does anybody know a fix to my problem? Every time I tried importing Dotween, unity suddenly showed compiler errors, but I didn’t make any changes in the projects and it was working before the import. Then I remove it and it works again. I couldn’t find any solutions online, so please.
Do u think it's efficient to add code to the wall it self, so that it can exchange information with the player to determine if it was the last wall u have ran on?
Too complicated, the easiest way would be to store the normal of the wall you're currently detecting, and then check every frame if it has changed -> If it did, you probably hit a new wall.
Not a perfect solution though
@@davegamedevelopment yes, it has its problems though, for example;
What if the player wants to fall down, and below him is curved wall that would lead to underground or something (kind of like a slide but turned to act as a wall)
The first normal would be the same as the previous wall.
@@hajjex_9086 im assuming all of the walls are named differently, maybe you can save the name of the wall as a string by detecting what wall you hit adn saving its name in a variable, idk much tho
my player also most teleports when jumping is there a fix for this
For me, doing it this way results in the players camera rotation being reset to the default value.
same
Hey, curious, is it possible you could do a tutorial on back flips or front flips like in DUSK? Where while you're in the air, the camera's X axis is completely unlocked allowing you to do sick flips. I tried doing this a while back when I used plai's scripts by doing something like:
if(!isGrounded)
xRotation = Mathf.Clamp(xRotation, -90f, 180f)
(i set it to 180f is cause I wanna go full on Matrix, like I slide underneath a big enemy and just unload a flurry of bullets in a full 180 degree.)
To a degree, it worked...except when I land on the ground I all of a sudden snap looking up or down. Like after I land doing a front flip, I snap to looking down, and when I do a backflip I snap to looking up.
Sounds interesting, I'll experiment with that once I have time, if it turns out nice, I'll make a tutorial :D
hi! it sounds interesting, have you succeded in doing this and if Yes could you please tell me how(or send the code)? thank you.
Grande penne
Qui Qui
Will that project file will work in unity 18
I am making mine with 3D view, but still want a camera tilt when wallrunning. However, I could not figure out how to tilt the cinemachine camera accurately; if anyone can help I'd much appreciate it!!
You ever figure it out?
@@saltyman5603nope not yet…
@@Alexgamer-pp7hm i did figure out some stuff, but kind of just gave up and just used his character controller. The cinemachine virtual cam has an fov variable and a variable called dutch that controls the tilt. The only issue is, if you use those, you can't use the dotween and have to think of a new method to lerp it. That is where I gave up.
@@saltyman5603Yeah, what i was considering was just making separate static cameras for each wall where i could do a wall slide, and then transition to those when i enter that area, but it’s very much based on the environment for the game. Not fun to place a bunch of separate cameras everywhere
Ive found 2 problems with the scripts, one is that if i just hold w towards a wall i can just stay floating in the side of it. That being said its not a huge problem since you cant move anyway so only option is to release anyway. But one that annoys me is that i seem to be able to run on a wall for an infinite amount of time as long as its curved inward, its ends the wallrun but manages to hold on because it just starts a new one. Is there a way to solve it like you did with the wallclimbing?
Put a physics material on your player colider and set friction and bounciness to 0 and minimum
@@ThiccestMayo Thanks, this helped me.
Add "if(wallLeft || wallRight) {exitWallTimer = exitWallTime}" inside the if loop that counts down the exitWallTimer. This way if you are still touching the wall during the exitingWall state, it will prolong the state until you actually leave the wall.
I've been following along whilst using the character controller, all has been fine except for the wall jump, it almost teleports the player in the jump direction. Any help?
Well you need to apply the movement over multiple frames, not just one. You probably need a bool that's true while you're jumping and then while this bool is active apply the jump force.
@@davegamedevelopment would this also work for regular jumping
I have an error. My player sticks to the wall, after the walltimer runs out, so what happens instead of dropping to the ground, since the player it's still stuck in the wall I only fall a little and then continue wallRunning, does anybody have any idea how I can solve it?
Having the same problem, did you find a solution? I need to be able to start wall running from happening again until I touch the ground
@@michaelcooper2781 having the same problem, did you find a solution?
Im having a problem with the wall jumping bit. After typing in all the exit code, I jump either high or almost not at all, what could fix that?
Are you using ForceMode.Impulse for the jumping? And also, you could Download the project file over my discord server to see how everything is set up :D
@@davegamedevelopment I think there is something wrong with the player movement script on my end, and I cant access it on my phone. Ive gone through the wall running script very closely, line for line, and saw no error. If you could put the most recent version of the movement script in the description as an individual file, I would greatly appreciate it. Thank you in advance. Also, Ive tried downloading the script through discord, but could not see the code.
did you ever fix this? im hella stuck rn with that issue
When falling, my Y velocity resets for a movement.... It feels bad when playing the game, plz tell the fix
I'm quite busy at the moment, but I'll look into it asap :D
@@davegamedevelopment ok boss
@@davegamedevelopment If you are free now, plz solve my issue
so my camera appears to be clipping through my character. Idk why this is but i cant figure out how to stop it. Any idea what i could do?
this is a bit late but you just need to go to your camera and change clipping planes to 0.01
Hi there ,I have doubt for making 3d boss ,with stages and powers.there is a channel named "joexscript" which have a 3d boss tutorial ,he speaks in Spanish.please watch it and if it is ok , please make a simplified one of the video of the boss mechanics because I didn't understand it .it would be very helpful.with animations
This is the video ruclips.net/video/87vCLy5IL2E/видео.html
A boss tutorial sounds nice, I'm probably gonna do this sometime :D
Ok great thank you so much.i hope the boss will have animations
I am getting an error saying that my camera does not have the method of DOTILT or DOFOV, i have copied the code 1:1 yet i am still running in to this problem. can someone help me?
If you have the asset that he mentioned(DoTween) then i think its cuz u put them in caps. its DoFov and DoTilt
i am getting an error
Assets\Scripts\WallRunningAdvanced.cs(173,12): error CS1061: 'PlayerMovementAdvanced' does not contain a definition for 'wallrunning' and no accessible extension method 'wallrunning' accepting a first argument of type 'PlayerMovementAdvanced' could be found (are you missing a using directive or an assembly reference?)
I know im late but its probably because your movement script is not called PlayerMovementAdvanced
I have also this problem but but my movement script have the right name...
When I do the get component at 5:43 it says “Camera does not contain a definition for DOFieldOfView” even though I imported the DOTween asset. Do you know what’s wrong?
Is the variable for the camera of type "Camera" or "Transform"? Because this function only works if you directly call it on the Camera component, not transforms :D
Wow I’m so dumb, thank you Dave!
@@krypticq4999 haha no problem, glad I could help!
hey bro do you know how to make cctv like rainbow six siege?
Create cameras and position them around the scene, all under one gameobject. Then, make a script in the parent gameobject, inside of it a list of all the cameras. Then, on whatever input, switch from the first item in the list, to the second and so on
any one has any idea on how to fix this error
Assets\Scripts\my scripts\PlayerCam.cs(4,7): error CS0246: The type or namespace name 'DG' could not be found (are you missing a using directive or an assembly reference?)
this is 3 months late but maybe for future reference- u have to make sure that every word is correctly capitalized or uncapitalized so the words match each other or else it won't work
Did you import the DG Tween asset that he uses in the video? Because otherwise Unity won't recognise DG.
When I jump off of the wall, it just floats. I think it's because it doesn't turn the rigidbody's gravity on again. Is there anyway I can fix that?
in StopWallRun add this rb.useGravity = true;
same
at the end of the wall run just put the rb.useGravity back to true
can i add wall jumping if i didnt add the wall running?
As long as you have the wallchecks in place yes
Anyone in the comments know where the OnSlope function is? been combing through the tutorial and i cant find it!!! thank u
check the slopes video
@@solidshrek thanks i got it!
uhhhhh it says using DG.Tweening; doesn't exist
What's good
that's good
@@davegamedevelopment looks good but I don't know if your codes work till I test them
How to I setup the dotween it has got so many errors
don't check off free/core
when I try to jump, it just floats like i'm on the moon, can anyone help?
Go to your project settings -> physics -> and then change the gravity to 0, -30, 0
3:53
Second
Congrats! :D
I have a problem with wall jump, when jumping from the first wall to another wall the wallrunning condition is inactive
oke, i fix this
@@ano7371 how did you fix this?
@@Centicc did you figure it you?
@@Centicc ok, it turns out I accidentally misspeled one of my exitWallTimer statements as ExitWallTime
@@ano7371hey, i know this is a really old comment, but i was wondering how you fixed the issue since im having the same one right now
my dude sounds like brackeys
Haha :D
@@davegamedevelopment thanks for the tutorial tho
my player just sticks to the wall for some reason
it dosent even move
Grappling gun video???????
Hey dave I followed your code to the last bit but when I do a wall run and the camera tilts it gives me this message "DOTWEEN ► Max Tweens reached: capacity has automatically been increased from 200/50 to 500/50. Use DOTween.SetTweensCapacity to set it manually at startup
UnityEngine.Debug:LogWarning (object)
DG.Tweening.Core.Debugger:LogWarning (object,DG.Tweening.Tween) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/Debugger.cs:40)
DG.Tweening.Core.TweenManager:GetTweener () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/Core/TweenManager.cs:109)
DG.Tweening.DOTween:ApplyTo (DG.Tweening.Core.DOGetter`1,DG.Tweening.Core.DOSetter`1,UnityEngine.Vector3,single,DG.Tweening.Plugins.Core.ABSTweenPlugin`3) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:1084)
DG.Tweening.DOTween:To (DG.Tweening.Core.DOGetter`1,DG.Tweening.Core.DOSetter`1,UnityEngine.Vector3,single) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:432)
DG.Tweening.ShortcutExtensions:DOLocalRotate (UnityEngine.Transform,UnityEngine.Vector3,single,DG.Tweening.RotateMode) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__DOTween/_DOTween.Assembly/DOTween/ShortcutExtensions.cs:592)
PlayerCam:DoTilt (single) (at Assets/PlayerCam.cs:48)
WallRunning:StartWallRun () (at Assets/WallRunning.cs:143)
WallRunning:StateMachine () (at Assets/WallRunning.cs:95)
WallRunning:Update () (at Assets/WallRunning.cs:60)"
and the camera does not reset with the tilt Pls help
So i got that issue out of the way no more warnings, but my camera still wont straighten itself out after the wall run is over, yes i have the ground set to whatIsGround, and yes i have the wall set to whatIsWall
OMG i figured it out it was so dumb i forgot to check mark "Use Gravity" srry
great vid tho
Hey Dave, I know it's a late comment. I'm having an issue. When I do the wall jump the first time, it works perfectly but the second time the jump is weak. It makes it impossible for me to chain wall jumps together.
// enter exiting wall state
exitingWall = true;
exitWallTimer = exitWallTime;
Vector3 wallNormal = wallRight ? rightWallHit.normal : leftWallHit.normal;
Vector3 forceToApply = transform.up * wallJumpUpForce + wallNormal * wallJumpSideForce;
//Add Force and reset Y velocity
rb.velocity = new Vector3(rb.velocity.x, 0f, rb.velocity.z);
Debug.Log("Adding Wall Jump force");
rb.AddForce(forceToApply, ForceMode.Impulse);
This works as expected and the debug gets logged every jump, yet the force seems to not be consistent throughout multiple jumps.
Also here is my walljump State Machine:
// State 1 - wallrunning
if ((wallLeft || wallRight) && verticalInput > 0 && AboveGround() && !exitingWall && canWallRun)
{
if (!wallrunnning)
{
StartWallRun();
}
if (Input.GetKeyDown(jumpKey))
{
Debug.Log("wall jumping");
WallJump();
}
}
//State 2 - exiting wall
else if (exitingWall)
{
if (wallrunnning)
{
StopWallRun();
}
if (exitWallTimer > 0)
{
exitWallTimer -= Time.deltaTime;
}
if (exitWallTimer
Also thanks for this amazing tutorial. I am so grateful for the time and effort you put into making this.
I have the same problem, did you ever find a fix?
I have a problem on wallrunning script : Assets\WallRunningAdvanced.cs(63,16): error CS1061: 'PlayerMovementAdvanced' does not contain a definition for 'wallrunning' and no accessible extension method 'wallrunning' accepting a first argument of type 'PlayerMovementAdvanced' could be found (are you missing a using directive or an assembly reference?)
your movement script is named "PlayerMovementAdvanced" and you dont have wallrunning setup in it