Awesome Third Person Shooter Controller! (Unity Tutorial)

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 พ.ย. 2024

ความคิดเห็น • 1.7K

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  3 ปีที่แล้ว +80

    💬 It took a lot of work to make this video but I'm really happy with the final result! I hope you like it!
    ✅ Get the Project Files unitycodemonkey.com/video.php?v=FbM4CkqtOuA
    🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
    👍 Learn to make awesome games step-by-step from start to finish.

    • @syedsadiq8631
      @syedsadiq8631 3 ปีที่แล้ว +2

      Also u want to continue mobile 3rd person shooter

    • @IlmarAlamsyah
      @IlmarAlamsyah 3 ปีที่แล้ว

      Sir, need new unity mega bundle review🙏

    • @ggre55
      @ggre55 3 ปีที่แล้ว

      aw man i love u tnks

    • @AlMgAgape
      @AlMgAgape 3 ปีที่แล้ว +1

      Look My Channel, Im Make A Mobile Legends 2D Version, Thank You😁🙏🙏

    • @lokesh4847
      @lokesh4847 3 ปีที่แล้ว

      It is so usefull sir. Can you please suggest any video, how to attach weapon to the player, like you used

  • @teppidd
    @teppidd 9 หลายเดือนก่อน +34

    for those stuck between 20:00-23:00:
    1. make sure the BulletProjectile script is on the pfBulletProjectile prefab (click the prefab and drag the script on).
    2. Also, click on the prefab and make sure Use Gravity is ticked off.
    Still following the tutorial, but was stuck for a good while on this. Good luck!
    update: works perfectly thank you so much this is an amazing tutorial

    • @irisshard2336
      @irisshard2336 7 หลายเดือนก่อน +5

      I have been stuck on this for an hour, thank you so much!

    • @hailrengaming4703
      @hailrengaming4703 7 หลายเดือนก่อน +3

      Thank you I was wondering why my bullet would spawn and just hover took me hours and reading this comment fixed it thanks!

    • @medad5502
      @medad5502 7 หลายเดือนก่อน +2

      Thank you!!! I spent 2 hours looking around and not understanding why it's not working lol
      You're a life saver!

    • @medad5502
      @medad5502 7 หลายเดือนก่อน +2

      @@irisshard2336 ikr! lol, I'm very happy now!

    • @frmemes5189
      @frmemes5189 5 หลายเดือนก่อน +2

      Thank you so much!

  • @AaronAsherRandall
    @AaronAsherRandall 2 ปีที่แล้ว +106

    If anyone is having difficulty aiming and walking at the same time, you need to create an Avatar Mask. Open up "Humanoid" in the Avatar Mask and deselect the legs and lower IK so that only the upperbody is green. Then, click the cog wheel on the Aiming layer and add the Avatar Mask to the Mask field. This will make it so that when aiming, only the upper body bones are affected and you will still be able to walk as per the Base Layer animations.

    • @ogunrindedaniel9230
      @ogunrindedaniel9230 ปีที่แล้ว +8

      Great point, In addition to this,
      make sure you set your model to humanoid.
      After you import your fbx file, under the inspector, select "Rig" and then choose "Humanoid" under the animation type.
      This will allow you to switch layers and also prevent the bug of (the character from showing halfway through the ground).

    • @noblephantasms7250
      @noblephantasms7250 ปีที่แล้ว

      Is the avatar mask created from the aiming animation fbx?

    • @Mport-UK
      @Mport-UK ปีที่แล้ว +3

      ​@@noblephantasms7250 You can do this by Right Clicking Create go down to Avatar Mask.
      From there I clicked on the legs, body and the bottom 1ks.
      Then on your Animator and your Aming Layer, click the gear icon, add the mask you just made and click on IK pass.... This is what I did any way works for me :)

    • @pawepatrzek2785
      @pawepatrzek2785 ปีที่แล้ว +1

      For people who don't know how to do it th-cam.com/video/W0eRZGS6dhQ/w-d-xo.html

    • @noblephantasms7250
      @noblephantasms7250 ปีที่แล้ว

      @@pawepatrzek2785 thanks for the reply although I just finished University last month

  • @StrunDoNhor
    @StrunDoNhor 3 ปีที่แล้ว +237

    I'll be real with you, channels such as Code Monkey and Brackeys are the reason I chose Unity over Unreal when it came to answering "which engine?"
    The quality and accessibility of tutorials such as these _cannot_ be overstated. Thank you for all the terrific content, and keep doing what you do! You've earned another subscriber/supporter!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +27

      I'm glad the videos helped you! Thanks!

    • @alsgaming1426
      @alsgaming1426 2 ปีที่แล้ว +2

      @@CodeMonkeyUnity why will nothing move or respond in the scene

    • @jaybehl7567
      @jaybehl7567 2 ปีที่แล้ว +3

      @@alsgaming1426 make sure scripts and stuff are attached?

    • @alsgaming1426
      @alsgaming1426 2 ปีที่แล้ว +1

      @@jaybehl7567 yes they are

    • @mrtutorials3960
      @mrtutorials3960 2 ปีที่แล้ว +1

      @@jaybehl7567 But where to attach BullectProjectile script ?

  • @Foxtrop13
    @Foxtrop13 3 ปีที่แล้ว +117

    you can put and "else{ mouseWorldPosition = ray.GetPoint(10);}" after the raycast so you dont need a collider for the skybox

    • @teknoard
      @teknoard 2 ปีที่แล้ว +2

      Thank you so much

    • @wmorais1976
      @wmorais1976 2 ปีที่แล้ว +8

      One of the most usefull comments on the TH-cam. Thank you!!!!

    • @agustin9594
      @agustin9594 2 ปีที่แล้ว +2

      EXCELENT

    • @tartoras
      @tartoras 2 ปีที่แล้ว

      I'm not sure how to implement this, unity says "mouseWorldPosition" does not exist in this context'

    • @agustin9594
      @agustin9594 2 ปีที่แล้ว +4

      @@tartoras look the script in the video, he created a Vector3 called "mouseWorldPosition"

  • @marcoszanre
    @marcoszanre 3 ปีที่แล้ว +39

    This is the first tutorial I found showing how to extend the Unity Starter controller up to a real use case scenario. Great content, thank you!

  • @adrianalcomendras6754
    @adrianalcomendras6754 3 ปีที่แล้ว +81

    its finally happening! Im really hoping for a melee combat tutorial that expands upon the 3rd person starter assets. would it be possible to have the melee combat have animations where you dont just animate the upper body to perform melee attacks? like if you do a melee attack, you wont be able to move until the melee animation has finished playing like in most action games? a combo and targeting system would also be nice :)

  • @rebornl
    @rebornl 2 ปีที่แล้ว +49

    For the hit scan on 27:08 if the particle shows up on the feet it is because it is using the player transform position.
    Make a var called like hitpoint, similiar to the debugTransform, in the 'raycast IF statement' set the new var hitpoint to the 'raycastHit.point', and in the shoot instantiate code replace transform.position to the hitpoint variable.
    Thanks for the tutorial, learned alot!

    • @S3R43o3
      @S3R43o3 2 ปีที่แล้ว +2

      ty dude =D

    • @jordyatondo1004
      @jordyatondo1004 2 ปีที่แล้ว +8

      Was having trouble with this, thank you. You can also just replace transform.position with debugTransform.position in that if statement.

    • @KelsGaming23
      @KelsGaming23 2 ปีที่แล้ว +1

      thanks bro I'm about to rage quit lol glad i check the comment section

    • @ShadowTM6
      @ShadowTM6 2 ปีที่แล้ว +1

      How ? replace ? I need help

    • @mrri5155
      @mrri5155 ปีที่แล้ว +2

      Thank u bro

  • @ed_halley
    @ed_halley 2 ปีที่แล้ว +9

    When you turn the character to the direction you're aiming, you use Lerp with the current position in the first argument. Lerp really works when you continually provide the original starting value and a final value on every frame. If you don't want to keep track of the original starting value, use MoveToward or RotateToward instead. The progression of values you get with Lerp are only linear if you use it as designed, with the original starting value on every call.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +1

      Yes I intentionally do not want it to be linear. I want it to be faster the further away it is from the target so it gets there faster.

  • @AbhayKumar-kb8tv
    @AbhayKumar-kb8tv 3 ปีที่แล้ว +34

    Thanks for the tutorial. It really helped me to move forward my project. Here is a tip:-
    Instead of placing cubes around the environment for player. just get a point from ray at a distance.
    Ray ray = _cam.ScreenPointToRay(screenCentrePoint);
    debugTransform.position = ray.GetPoint(20);
    GetPoint will give you at point on the ray at the distance you have given. so even if player is aiming at the sky it will work without placing collider around environment.

    • @stevenbraun918
      @stevenbraun918 3 ปีที่แล้ว +14

      Vector2 screenCenterPoint = new Vector2(Screen.width / 2f, Screen.height / 2f);
      Ray ray = Camera.main.ScreenPointToRay(screenCenterPoint);
      if (Physics.Raycast(ray, out RaycastHit raycastHit, 999f, aimColliderLayerMak)) {
      debugTransform.position = raycastHit.point; }
      else
      {
      debugTransform.position = ray.GetPoint(20f);
      }
      Like this right?

    • @Az555
      @Az555 3 ปีที่แล้ว +2

      Damn bro, I was about to ask if there was a way to fix that, and there you go saving the day. Thanks mate!

    • @kingkangiv1615
      @kingkangiv1615 2 ปีที่แล้ว +5

      If anyone is a fool like me, make sure you also set the moustWorldPosition = to the ray.Getpoint() otherwise when you aim at the sky your not getting that variable updated.

    • @RogerBaconGaming
      @RogerBaconGaming 2 ปีที่แล้ว +1

      Yes, this is exactly the solution I was looking for. Thank you.

    • @HATL201
      @HATL201 2 ปีที่แล้ว +1

      Edit:
      This does fix the abrupt change of aim when going from one target to another, but the aim is no longer accurate. I think I'll have to find a way to smooth out that abrupt change.
      ____________________________________________________
      Great idea, thanks. Additionally, I would say that when you're aiming at objects other than sky, still better to use debugTransform.position = ray.GetPoint(20); because in this way your aiming will stay smooth. If debugTransform keeps jumping from object to another, your character's aim abruptly changes, which in my opinion is not desirable (at least for my game design):
      Here's the code :
      Vector3 mouseWorldPosition = Vector3.zero;
      Vector2 screenCenterPoint = new Vector2(Screen.width / 2f, Screen.height / 2f);
      Ray ray = Camera.main.ScreenPointToRay(screenCenterPoint);
      if (Physics.Raycast(ray, out RaycastHit raycastHit, 999f, aimColliderLayerMask))
      {
      debugTransform.position = ray.GetPoint(20f);
      mouseWorldPosition = ray.GetPoint(20f);
      }
      else
      {
      debugTransform.position = ray.GetPoint(20f);
      mouseWorldPosition = ray.GetPoint(20f);
      }

  • @tanc4635
    @tanc4635 2 ปีที่แล้ว +17

    Another great tutorial, thanks a lot! Also I think I found a neat solution for aiming in the sky (14:02), without needing boundary colliders everywhere. If the raycast returns false move to an else block and create the aiming point by projecting a vector in the direction of the camera orientation, from the camera position, at a desired distance from it. For example I set mine to 200:
    if (Physics.Raycast(ray, out RaycastHit raycastHit, 200f, AimColliderLayerMask))
    {
    DebugTransform.position = raycastHit.point;
    }
    else
    {
    DebugTransform.position = _cam.transform.position + _cam.transform.forward * 200f;
    }
    Let me know if I am overseeing something and there is a problem with this, but thanks again for the video.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +6

      Yup that's an excellent approach, that's what I would do if I used this controller in a full game instead of just a simple demo.

    • @alovelygondal7673
      @alovelygondal7673 11 หลายเดือนก่อน

      hey can you tell me like _cam is what what ihave to give refrence of here

    • @TheMavryan
      @TheMavryan 10 หลายเดือนก่อน

      @@alovelygondal7673 Hi, this is in relation to the main camera. if you want you can use this instead which will work as long as you have one main camera.
      else
      {
      debugTransform.position = Camera.main.transform.position + Camera.main.transform.forward * 999f;
      }

  • @Ez-_-69.
    @Ez-_-69. ปีที่แล้ว +7

    The instantiating bullet can be used in a realistic game as then we can set the spawn point in the guns barrel and then if this happens( 27:54 ) then it shows that the bullet actually spawns from the guns itself and not from the middle of the screen, many realistic FPS/TPS games do this thing and it adds that extra bit of realism to the game really cool, raycast can be used for a more arcade shooter

  • @DarkParadice
    @DarkParadice ปีที่แล้ว +8

    You should do a tutorial on a First Person Controller setup with full body awareness and animation rigging. I just realized while putting mine together that there are no real good tutorials for that out there for reference so I had to do mine all by scratch. It was actually more tricky than I expected. I never realized things like keeping the head and body separate for networking reasons. Or how difficult it really is to get the body to perform like an actual body in relation to eye sight and the hands/gun movement.

  • @tonyhamilton7785
    @tonyhamilton7785 3 ปีที่แล้ว +5

    This! This is what I needed to know to make the game I had in my head for almost a year, but put it to the side for easier challenges

  • @AlexraptorGameDev
    @AlexraptorGameDev 2 ปีที่แล้ว +7

    Excellent tutorial! I had already got a basic combat system going with the Third Person Controller, but I was not at all happy with the camera. This tutorial made it all right as rain, thank you! :)

  • @Xahos_
    @Xahos_ 2 ปีที่แล้ว +34

    For bullet not working, :
    - Add the bullet script to your bullet => he not showed it but it said it (i realised that after 10x watching haha)
    - Make your bullet a prefab, drag and drop it in the prefab folder. Than delete it from the scene, and drag and drop the prefab in "Bullet Projectil" from thirdPersonShooterController on the playerArmature
    - If it bounce/not destroy; make the colider a few bigger than the cube

    • @samuelfairbrass4161
      @samuelfairbrass4161 2 ปีที่แล้ว +2

      Wow I was stuck on that for so long! Thank you!

    • @DeKosta
      @DeKosta 2 ปีที่แล้ว +5

      Thank you brother! These comments are gold for unity noobs that miss these subtle things and get stuck and on the verge of saying fuck this.

    • @khushtrivedi14
      @khushtrivedi14 ปีที่แล้ว +2

      @@DeKosta Literally was me a second before I found this haha

    • @khushtrivedi14
      @khushtrivedi14 ปีที่แล้ว +2

      Not all heroes wear capes

    • @mrri5155
      @mrri5155 ปีที่แล้ว +2

      Thank u Bro

  • @HHungriaP
    @HHungriaP 3 ปีที่แล้ว +49

    There is a legend that someday CodeMonkey Sensei will explain how to work with the animation Rigging Package ...

    • @Fizz17
      @Fizz17 3 ปีที่แล้ว +5

      Brackeys made a tutorial on animation rigging, you should check it out

    • @HHungriaP
      @HHungriaP 3 ปีที่แล้ว +1

      @@Fizz17 Yes I found somebody videos but I love Code Monkey videos Tutorials. He is ver clear and I can Understand all that he show...

    • @shivamvishwakarma4317
      @shivamvishwakarma4317 3 ปีที่แล้ว +2

      You can also check kiwi coder he is doing a series using animation rigging

    • @sae-institute
      @sae-institute 3 ปีที่แล้ว +1

      Yes, this is the way

  • @cyrilleger7846
    @cyrilleger7846 2 ปีที่แล้ว +12

    if you feel that the camera lags when you move the mouse, you can try this solution found on Unity forum :
    2021.2.7 uses version 1.2 of the Input system package which has an issue with inputs delta when set to fixed update and can cause the lags you are seeing.
    To check if that's the issue you could try this:
    Edit -> project settings -> Input system package
    If Update Mode is set to Process events in fixed update change it to Process events in dynamic update
    I hope this will help you and thank's for this tutorial :)

    • @AmentagIno
      @AmentagIno 2 ปีที่แล้ว +2

      Thanks a lot!
      This fixed the camera lag i had!

    • @greeng448
      @greeng448 2 ปีที่แล้ว +1

      Thank you

  • @RyanGumley
    @RyanGumley 3 ปีที่แล้ว +5

    I absolutely love this video. Right up to the point of adding a point animation. I can't find anything easy to follow that will allow me to add animations to the standard unity third person controller.

    • @trentwilliams7829
      @trentwilliams7829 2 ปีที่แล้ว +5

      I figured this issue out for anyone else that might come across the same problem. I did this - Go to the "Rig -> Animation Type" and change from "Generic" to "Humanoid" and click on "Apply". That fixed it.

  • @TheMavryan
    @TheMavryan 10 หลายเดือนก่อน +4

    Also for the crosshair if anyone wants an easy way to enable it when aiming and disable when not you can add
    [SerializeField] private GameObject crosshair; // makes a serialized field for the image of the crosshair to be assigned to.
    In Awake: crosshair.SetActive(false); // hides the crosshair to make sure it is hidden at the start.
    In Update
    if (starterAssetsInputs.aim) // if the user is aiming
    {
    crosshair.SetActive(true); // set crosshair to enabled.
    }
    else // if they are not aiming
    {
    crosshair.SetActive(false); // disable the crosshair
    }
    Then in Unity drag the crosshair image onto the serialized field.
    Hope this helps anyone who wants this easily.
    The full code up to the crosshair section for me is:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Cinemachine;
    using StarterAssets;
    public class ThirdPersonShooterController : MonoBehaviour
    {
    [SerializeField] private CinemachineVirtualCamera aimVirtualCamera;
    [SerializeField] private float normalSensitivity;
    [SerializeField] private float aimSensitivity;
    [SerializeField] private GameObject crosshair;
    private StarterAssetsInputs starterAssetsInputs;
    private ThirdPersonController thirdPersonController;
    private void Awake()
    {
    starterAssetsInputs = GetComponent();
    thirdPersonController = GetComponent();
    crosshair.SetActive(false);
    }
    private void Update()
    {
    if (starterAssetsInputs.aim)
    {
    aimVirtualCamera.gameObject.SetActive(true);
    thirdPersonController.SetSensitivity(aimSensitivity);
    crosshair.SetActive(true);
    }
    else
    {
    aimVirtualCamera.gameObject.SetActive(false);
    thirdPersonController.SetSensitivity(normalSensitivity);
    crosshair.SetActive(false);
    }
    }
    }

    • @adamcookie26
      @adamcookie26 9 หลายเดือนก่อน

      Hey thanks it worked. It took a few tries because I'm not a coder and was far ahead by the time I found this comment

    • @LegendsTap
      @LegendsTap 8 หลายเดือนก่อน

      is there any way that this virtual camera only follows characters back and on look input its works same before ...if character rotate than the virtual camera shoul have to rotate as to follow charcters back

  • @GameBoy-ov9xi
    @GameBoy-ov9xi 3 ปีที่แล้ว +1

    You are probably the only real help out there! Ty so much bro!!! Patron this guy... he deserve it!

  • @zoeypaine7476
    @zoeypaine7476 3 ปีที่แล้ว +8

    Honestly this is awesome. Doing this except for a melee system would also be awesome, to cover both melee/ranged weapon systems.

  • @teppidd
    @teppidd 8 หลายเดือนก่อน +1

    for those wanting to make an automatic weapon, here's what I did (idk how much it'll help since I've changed the code quite a bit since following this tutorial)
    1) add 3 variables to the top of the script:
    private bool isFiring = false;
    float shotCounter;
    public float rateOfFire = 0.1f;
    2) in update, add this where you're instantiating your bullet:
    if(starterAssetsInputs.shoot)
    {
    isFiring = true;
    }
    else if(starterAssetsInputs.shoot == false)
    {
    isFiring = false;
    }
    if(isFiring == true)
    {
    shotCounter -= Time.deltaTime;
    if(shotCounter

  • @freezinfire
    @freezinfire 3 ปีที่แล้ว +3

    I have waited so long for this, thank you Mr. Monkey

  • @wmorais1976
    @wmorais1976 3 ปีที่แล้ว +2

    Finally a simple and good tutorial about third person shooter. There's a lot out there but each one more difficult then other. Congratulations for this awesome tutorial.

  • @B1naryShark
    @B1naryShark 3 ปีที่แล้ว +11

    This is perfect, I'm currently working on and trying to learn how to make some good feeling Third person shooter controls!

  • @jovelove2115
    @jovelove2115 9 หลายเดือนก่อน

    An absolute god you are. My first game will surely be completed because of you. Thank you.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  9 หลายเดือนก่อน +1

      Best of luck with your game!

  • @DJRussellBrian
    @DJRussellBrian ปีที่แล้ว

    dude thank you so much for this!!! I've been pulling my hair out for months trying to figure this new input system out and though I'm still reluctant to say I figured it out, I definitely made progress finally today with combining what I've been trying to do with what you did here... Thank you so much for this upload! You're making dreams come true my friend!

  • @tmoneygamestudio
    @tmoneygamestudio 3 ปีที่แล้ว +4

    Great little tutorial. I liked the new input system you are using compared to the old one. The coding you added for the third person controller was also pretty informative. Gotta save this to use later if I get around to doing a tps shooter demo in the future.

  • @mrwhiteeagle
    @mrwhiteeagle 2 ปีที่แล้ว

    I'll be honest, what i was expecting was ful tutorial without assets. But good theres a person that creates these free of charge for everyone ^^. Keep it up!

  • @upsurge5541
    @upsurge5541 3 ปีที่แล้ว +6

    I've been searching online for a true first person shooter controller Tutorial and found nun if you could make one that would be amazing for those of you who don't know what a true FPS is it's like a third person controller it uses third person animations and a full body but the camera is mounted on the head games like escape from tarkov and arma 3 use it

  • @CRUMVIII
    @CRUMVIII 3 ปีที่แล้ว +5

    33:21 This part does interest me a lot since it's one of the things I've had issues with for upper body aiming. I tried IK but it didn't quite work out as I wanted.

    • @zexanein
      @zexanein 2 ปีที่แล้ว +2

      Select Rig, Change Avatar Definiton to "Copy From Other Avatar", and select Armature Avatar as source

    • @xxxCrysisxxx99
      @xxxCrysisxxx99 2 ปีที่แล้ว +2

      @@zexanein Thank you, I was struggling with this all day!

  • @chrheca
    @chrheca 3 ปีที่แล้ว +34

    I saw an error: @ around 27:20, near the ending of the Raycast shooting tutorial, the Instantiate methods are spawning the particles at transform.position, aka the player position.
    This makes the particles spawn inside the player.
    It should be changed to mouseWorldPosition or debugTransform.position which is the raycast.point value of where the raycast hit.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +11

      Oh yeah nice catch, yup it should be the mouseWorldPosition, seems I cut the video where I fixed it

    • @chrheca
      @chrheca 3 ปีที่แล้ว +1

      Its funny when you do it because it looks like the character is exploding! Could you maybe add or explain the steps to get the Pistol Idle animation from Mixamo? I can only download the entire mesh, I dont know how to extract the .animation file from the .fbx

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +2

      @@chrheca Click on the arrow icon to expand the object, inside is the animation, click on it then Ctrl + D to duplicate and it will duplicate it outside of the .fbx as a separate asset

    • @pytchoun140
      @pytchoun140 3 ปีที่แล้ว +4

      @@CodeMonkeyUnity Something is missing the animation isn't playing and on preview it is a T mode animation

    • @marcoguerrero4406
      @marcoguerrero4406 2 ปีที่แล้ว +4

      Thank you, I spent like an hour trying to find my mistake haha

  • @neelamshahi8630
    @neelamshahi8630 3 ปีที่แล้ว +2

    Finally video launch lovely video

  • @bdd740
    @bdd740 3 ปีที่แล้ว +4

    Please add simple climbing and ledge hanging. Thanks great series.

  • @kelseyo4
    @kelseyo4 8 วันที่ผ่านมา

    Just in case someone would be interested, you can also rotate the character (when aiming) based on the camera planar direction, this way it will always rotate according to the camera :
    Vector3 cameraPlanarDirection = Vector3.ProjectOnPlane(Camera.main.transform.forward, transform.up).normalized;
    transform.forward = Vector3.Lerp(transform.forward, cameraPlanarDirection, Time.deltaTime * 20f);

  • @SwagWizard555
    @SwagWizard555 3 ปีที่แล้ว

    I just skipped to the end to first see how it will look like when i set it up and instantly liked. Just what i needed for my game (:

  • @Fizz17
    @Fizz17 3 ปีที่แล้ว +5

    Can you make a video on how you polished everything at the end? Because I have the animations and functionality down, but it would be very helpful if there was a video showing how to add for example a walking animation while aiming, all the FX used and so on.
    Other than that this video was great and really helpful :)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +4

      I'm planning on doing a video on animation rigging which is what I used to make the weapon aim at the target
      For walking while aiming, that's just adding a Avatar mask on the second layer and only overriding the upper body, leaving the legs to walk

    • @kaisinelmusic
      @kaisinelmusic 3 ปีที่แล้ว +1

      @@CodeMonkeyUnity Hey Code Monkey! What if I want incorporate a different movement animation while aiming? How does that work? Can you please make a video on that one or could you briefly explain it?

    • @rickyreaves5794
      @rickyreaves5794 2 ปีที่แล้ว

      @@CodeMonkeyUnity ahhhhh see that's good so instead of doing it through code, animation rigging makes that much simpler, nice!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +2

      @@rickyreaves5794 I have since made that video on how the Aim Animation Rigging works unitycodemonkey.com/video.php?v=luBBz5oeR4Q

  • @TopiasNykänen
    @TopiasNykänen 3 หลายเดือนก่อน

    Awesome video! Would love to see/purchase a full (or more expansive) third person shooter (or FPS) tutorial from you ^^

  • @draftdimension9079
    @draftdimension9079 3 ปีที่แล้ว +20

    SOOOO first go-round I broke everything at 7:00 into the video. My error was that Code Monkey quickly attaches the script for toggling between the zoom and normal camera that I missed that he had attached the PlayerAimContorller script to the PlayerAmature rather than the PlayerAimCamera. I have about a weeks worth or Unity so for anyone else that hits this error hope this helps.

    • @MyMusic-pi6lz
      @MyMusic-pi6lz 2 ปีที่แล้ว +1

      Had same error dude

    • @undead1055
      @undead1055 2 ปีที่แล้ว

      Third person shooter controller?

    • @davisardians8411
      @davisardians8411 2 ปีที่แล้ว +2

      I know how to fix it... just open your thirdpersonshooter script and change private void"awake" and "update" to "Awake" and "Update". (capital letters)

    • @cmdhazmad3352
      @cmdhazmad3352 2 ปีที่แล้ว +1

      i know im late to the party and i might have missed it but i did also have about 100 errors rolling in a minute when i had hit play to test out the zoom, what fixed it for me is under PlayerArmature, the ThirdPersonShooterController script, i dragged the PlayerAimCamera into the Aim Virtual Camera, and the errors went away and is working as it should be. hopefully that helps anyone out that might be having that issue or overlooking something potentially simple.

    • @frmemes5189
      @frmemes5189 2 ปีที่แล้ว +1

      @@davisardians8411 thanks so much it worked

  • @SakshamGarg-1
    @SakshamGarg-1 8 หลายเดือนก่อน +1

    14:26 A more simple solution
    if(Physics.Raycast(ray, out RaycastHit raycastHit, 999f, aimColliderLayerMask))
    {
    debugTransform.position = outhit.point;
    }
    else
    {
    debugTransform.position = ray.GetPoint(30);
    }
    When there isn't a collider in front of the player, the target point will be a little bit away from him if you write this code.

  • @mootvey
    @mootvey ปีที่แล้ว +7

    If you want the crosshair to only appear when you right click (like in a non-shooter focused game with shooting mechanics) then make a new script with this:
    using UnityEngine;
    using System.Collections;
    public class Cross : MonoBehaviour
    {
    // Graphic used for crosshair
    public Texture2D crosshairTex;
    // Rect for crosshair size and position
    private Rect crosshairRect;
    // bool to turn crosshair on and off
    public bool IsCrosshairVisible = true;
    void Awake()
    {
    Cursor.visible = false;
    crosshairRect = new Rect((Screen.width - crosshairTex.width) / 2,
    (Screen.height - crosshairTex.height) / 2,
    crosshairTex.width,
    crosshairTex.height);
    }
    void Update()
    {
    if (Input.GetMouseButtonDown(1))
    {
    IsCrosshairVisible = !IsCrosshairVisible;
    }
    if (IsCrosshairVisible == true)
    {
    IsCrosshairVisible = true;
    }
    else
    {
    IsCrosshairVisible = false;
    }
    }
    void OnGUI()
    { // draw the crosshair in center of screen
    if (IsCrosshairVisible)
    GUI.DrawTexture(crosshairRect, crosshairTex);
    }
    }

    • @deluxe_1337
      @deluxe_1337 ปีที่แล้ว +1

      @@CDisplay-o9t Or just:
      void Update() {
      IsCrosshairVisible = Input.GetMouseButtonDown(1);
      }
      😱😱😱

    • @Blinkers2007GameDev
      @Blinkers2007GameDev ปีที่แล้ว +1

      @@CDisplay-o9t that works. I actually used this line of code(input.getmousebutton down and up) to make the aiming instead of using the new input system. Works well for me!

  • @_l3m35_
    @_l3m35_ 3 ปีที่แล้ว

    I was trying to find out how to add new buttons to the Starter Assets. Thanks!

  • @あれくす
    @あれくす 3 ปีที่แล้ว +9

    Code Monkey, you have outdone yourself. This is so fantastic. It also provides a great framework to expand upon. Thanks so much for providing so much learning for no cost to the viewer! Youre doing the community such a wonderful service. We are all so very grateful for your time and hard work helping all the little guys and gals out there trying to get better! Thanks!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      I'm glad you liked the video! Thanks!

    • @JimmyThe
      @JimmyThe 3 ปีที่แล้ว

      @@CodeMonkeyUnity Great video. Could you tell us anything about the post processing you have set up? Is that just the demo scene in URP or are you using custom PP? I ask because I'm using HDRP and my demo scene doesn't look anywhere as nice as yours. Thanks for the great content. Liked and subscribed :D

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      @@JimmyThe It's just Bloom, a bit of Saturation and a Vignette effect

  • @jonathanglock1574
    @jonathanglock1574 ปีที่แล้ว +1

    Thank you for making this video. And all of your many other videos. They have proven to be very helpful in my learning. That said. In this video. The one thing I would have liked to have seen is a way to make Crosshair only come up when you are aiming. Thanks for the video!

  • @mihiragarwal8022
    @mihiragarwal8022 3 ปีที่แล้ว +4

    Which pack did you use for the gun animations for the final demo?

  • @IndieScapeGames
    @IndieScapeGames 3 ปีที่แล้ว +1

    Best video yet @Code Monkey! And great point at the end to 'never stop learning'. Sooo true

  • @karaliuss9041
    @karaliuss9041 3 ปีที่แล้ว +8

    i love this tutorial and everything was going smoothly until i finished the bulletprojectile script... the bullet would spawn in the scene but it wouldnt have any velocity, it just spawns and stays still. anyone had similar issues? ive rewatched and checked my scripts 20 times, still no fix

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      Add a Debug.Log where you're setting the velocity, is that line running? Are you maybe setting it to 0,0,0?

    • @-pcmr-108
      @-pcmr-108 3 ปีที่แล้ว +6

      Is your script actually attached to the bullet prefab?

    • @corsneer9835
      @corsneer9835 3 ปีที่แล้ว +2

      ​@@-pcmr-108i faced the same problem and i tried what you said and that was the error for me idk how i did missed that but thank you !.

    • @mrtutorials3960
      @mrtutorials3960 2 ปีที่แล้ว +1

      Bro facing the same problem.

    • @mrtutorials3960
      @mrtutorials3960 2 ปีที่แล้ว +1

      Bro i just fixed it what was the mistake is that in I forgot to writeline that was
      mouseWorldPosition = raycastHit.point;
      in ThirdPersonShooter Script in :
      if (Physics.Raycast(ray, out RaycastHit raycastHit, 999f, aimColliderLayerMask))
      you also check it as his video is so fast that I didn't even noticed even after watching 10 times

  • @arakielgazorkull
    @arakielgazorkull 4 วันที่ผ่านมา

    Any chance you are willing to do a video on things you did in the final polished version? the weapon shake effect in particular is very cool, not to mention that you seem to have managed to use animation layers without the top layer twisting your character 45 degrees to the left, which is currently frustrating the hell out of me.

  • @CosmicAlchemistt
    @CosmicAlchemistt 2 ปีที่แล้ว +6

    Great walkthrough CM. I was wondering if you experienced problems with the mixamo weapon related anims. Im experiencing a problem with ALL the weapon/aim anims from mixamo when applying the 'aim' animation layer mask weight to 1. Before applying the weight the character is facing straight forward in the idle animation like normal but when i make the weight 1 and activate the aim anim the character does not aim straight forward but to the left. So he goes from facing north to facing north west when the animation layer mask is applied. When setting up animation rigging to correct this the character just falls halfway into the ground and doesnt perform the idle animation but instead is just frozen in a weird pose.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +1

      I haven't encountered that issue but if you select the FBX file you downloaded and look in the inspector import animation settings you can change lots of things including applying a rotation offset

    • @CosmicAlchemistt
      @CosmicAlchemistt 2 ปีที่แล้ว

      @@CodeMonkeyUnity You truly deserve more love! Thank you 🙏

    • @Luffius
      @Luffius 2 ปีที่แล้ว

      @@CosmicAlchemistt Could you pls explain to me what you have done to fix this problem?

    • @briggandersen2936
      @briggandersen2936 2 ปีที่แล้ว +2

      @@Luffius I had this same problem, if you go to the inspector for the animation, then go to animation window and go down to motion you can set it to the joints of the PlayerArmature or whatever you want it to rotate towards at the start of the animation. This is using the root motion node.

    • @stuartdunan5970
      @stuartdunan5970 2 ปีที่แล้ว +5

      Bit late for an answer but if you select the animation taken from Mixamo once imported select Animation tab then scroll down to Root Transform Rotation and set it from Body orientation to original that should sort the aiming offset out.

  • @GameDevMarek
    @GameDevMarek 11 หลายเดือนก่อน

    At 06:44 you could change priority of virtual camera instead of disabling the GameObject.
    And at 16:05 you could just use Camera's transform.forward instead for calculating screen center and creating Ray with Camera object.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  11 หลายเดือนก่อน +1

      Yes those are perfectly valid alternatives

  • @FrostedWaffle
    @FrostedWaffle 2 ปีที่แล้ว +4

    I'm having this weird issue where after I complete the work from the aim input section my camera starts moving weirdly, it starts teleporting instead of smoothly moving on screen.

    • @kelvinhuurman4247
      @kelvinhuurman4247 2 ปีที่แล้ว

      same here

    • @TMosier88
      @TMosier88 2 ปีที่แล้ว +3

      I had the same issue. I tried EVERY fix I could Google. What finally "fixed it" for me was just closing Unity, playing Rocket League for a little bit and then coming back to it. I don't know what the **** happened in between but restarting Unity and going right back in, did NOT work. But coming back an hour later did? I have no idea. Its the second time I've come across this issue and the second time that little "turn it off and come back later" fix worked.
      I know its not exactly a solution but, that did it for me so I figured I'd share.

    • @kirie0801
      @kirie0801 2 ปีที่แล้ว

      Still having this issue. Anyone found a solid way to fix this?

    • @2BRAC4
      @2BRAC4 2 ปีที่แล้ว

      So this worked for me. I selected the PlayerArmature in the Hierarchy then in the Inspector I expanded the PlayerInput component and then clicked on Open Input Settings button. In the settings window I changed the Update Mode to Process Events in Dynamic Mode and that fixed it for me. Not sure about the trade offs of selecting this Update Mode though.

  • @diliupg
    @diliupg 3 ปีที่แล้ว +1

    This is a fantastic workout with the new Input system and the third-person character controller! Very well done! Thanks!

  • @Santosh-tq4nj
    @Santosh-tq4nj 3 ปีที่แล้ว +5

    Thanks for the tutorial. But I have a question in the Animation section. I followed the steps like you showed at 29:20 and gave the "Aiming" layer a weight of 1 but for me it still is in the Idle animation of Base Layer. I can see that the Pistol Idle animation is playing as that blue line of progress runs on that state, but in the Game window, the character doesn't actually follow that animation but rather is still in the base layer idle animation. Any ideas as to what could be the issue here? Thanks.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +1

      Did you maybe assign a mask with nothing selected? Does the aim animation work correctly by itself?

    • @Santosh-tq4nj
      @Santosh-tq4nj 3 ปีที่แล้ว +2

      @@CodeMonkeyUnity I replied a follow-up after a couple of days, but it's gone for some reason. Thanks for the prompt response from your side.
      Anyway, figured this issue out for anyone else that might come across the same problem. I did this - Go to the "Rig -> Animation Type" and change from "Generic" to "Humanoid" and click on "Apply". That fixed it.

    • @TobyWild
      @TobyWild 3 ปีที่แล้ว +1

      I had the exact same issue and BAM, there's your comment... thank god I didn't stop scrolling :) Thanks Santosh and CodeMonkey!

    • @darshankhaire879
      @darshankhaire879 2 ปีที่แล้ว

      @@Santosh-tq4nj hey need help in this can you please explain these steps in detail as i am new to unity

    • @romeroamaroquearts
      @romeroamaroquearts 2 ปีที่แล้ว +1

      @@darshankhaire879 have you managed to solve it?

  • @ads4752
    @ads4752 2 ปีที่แล้ว +1

    This channel is the best for indie devs like me 🥰

  • @LightVelox
    @LightVelox 3 ปีที่แล้ว +3

    tbh the controller from Unity is kinda trash since the jump and everything is basically hard coded, if you want to do something like removing the player control after jumping you basically have to rewrite everything

    • @justinbeam4233
      @justinbeam4233 9 หลายเดือนก่อน

      I like using FSMs. Tried this for the first time after writing different controllers bc it takes a long time to get everything nice and polished. Immediately hated it. I cant come up with game ideas anyway, so I'll just keep working on third person character controllers

  • @mepaul7016
    @mepaul7016 3 ปีที่แล้ว +2

    can't wait for the Code Monkey's 3D TPS game in the future

  • @err_demon
    @err_demon ปีที่แล้ว +3

    For anyone having trouble getting the center of the screen with ScreenPointToRay and the Screen/2f method, this helped me out.
    Vector2 screenCenterPoint = new Vector3(0.5f, 0.5f, 0);
    Ray ray = Camera.main.ViewportPointToRay(screenCenterPoint);

  • @mutlugameofhalit
    @mutlugameofhalit 7 หลายเดือนก่อน +1

    if you have any questions ask me, i spent hours on this tutorial to made it working from 0.

    • @clips_from_everything
      @clips_from_everything หลายเดือนก่อน

      Hi dude at 13:00 when I attach the sphere to the debug transform and play the scene nothing happens the sphere stays where it was placed and it does not follow the camera

    • @UnofficialGalacticRepublic
      @UnofficialGalacticRepublic 2 วันที่ผ่านมา +1

      @@clips_from_everything for me the sphere moves but when im aiming it stays still

    • @clips_from_everything
      @clips_from_everything 2 วันที่ผ่านมา

      @@UnofficialGalacticRepublic copy the script paste it and chat gpt and type "When I aim the debug transform stays in place" or something like that and test what it will give you but make sure to backup your original code just in case

    • @UnofficialGalacticRepublic
      @UnofficialGalacticRepublic 2 วันที่ผ่านมา

      @@mutlugameofhalit I just carried on in the tutorial and it somehow got fixed along the way

  • @kratosdisciple4637
    @kratosdisciple4637 ปีที่แล้ว

    Instead of using the Raycast, I just add an empty Gameobject to the MainCamera with a z distance of 500 and use its position for worldAimTarget.
    Don't have to get the screen center or add the invisible walls.

  • @kevinzheng6867
    @kevinzheng6867 2 ปีที่แล้ว +1

    Sorry for my bad english but if u can shoot u need to swap bullet scrip in pfbulletprojectile

  • @ahmednaeem9223
    @ahmednaeem9223 ปีที่แล้ว +1

    really love this guy and his efforts.

  • @BottleHeadGames
    @BottleHeadGames 3 ปีที่แล้ว

    I was waiting for this since the day it was announced, Thank you!!!!

  • @621dude
    @621dude 2 หลายเดือนก่อน

    This is Great I have purchased the Space Combat kit from unity and I would like to implement my character with this into it. It would be awesome if you can do a tutorial on the space combat kit and implementation of this.

  • @unknownuser260
    @unknownuser260 ปีที่แล้ว

    Hi Code Monkey, Thanks for the step by step guide. I'm not a programmer, so your videos has been a ton of help to me. It's just that I'm having problem getting the bullet projectile to move

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว

      Did you set the rigidbody.velocity? Also make sure you're not spawning it inside a collider

    • @unknownuser260
      @unknownuser260 ปีที่แล้ว

      @@CodeMonkeyUnity I did, but it just "float" at the spawn until a new bullet spawns in and knocks it away.

    • @federicofornari562
      @federicofornari562 ปีที่แล้ว +1

      @@unknownuser260 have the same problem, i've checked and re-checked the code at least 5 times, the game object inside the player is at the right distance, everything seems in order... i'm using Unity 2021.3.11f1, dunno if it's a useful info or not

    • @alexsulea429
      @alexsulea429 ปีที่แล้ว +1

      Same happened to me, I think you forgot to attach the BulletProjectile.cs script to the bullet prefab as a component. Code Monkey dosent mention that step in the video but you have to do it if you're going to add velocity to your bullet.

    • @ferruman
      @ferruman ปีที่แล้ว

      @@alexsulea429 thank you, I thought I was going crazy and missing something despite going over it a dozen times

  • @rsrivishwanath6724
    @rsrivishwanath6724 2 ปีที่แล้ว +1

    Thanks for the motivation.

  • @batuhanbatuhan4131
    @batuhanbatuhan4131 2 ปีที่แล้ว

    I was just about to fall asleep then the video began. Like a bucket of ice water.

  • @ashwinj9879
    @ashwinj9879 3 ปีที่แล้ว

    your visual studio burns my eye😂

  • @aucer7904
    @aucer7904 3 ปีที่แล้ว

    Add "Volume" to your bullet ,and press new profile ,add "Bloom" intensity set to 1 , you will have a nie and shiny like ball in the video.

    • @aucer7904
      @aucer7904 3 ปีที่แล้ว

      volume add "postprocessing" color adjustment >> contrast ,then your scene will be more colorful

  • @nielshenriksen1043
    @nielshenriksen1043 3 ปีที่แล้ว +1

    all your videos are good.... But this is best :)

  • @Chris_Stewart
    @Chris_Stewart 3 หลายเดือนก่อน

    Love the content, but could you slow down some. You type at full speed and then scroll as soon as your done to the next spot. Very hard to follow along without pausing and rewinding every few seconds.

  • @Stevanmesser
    @Stevanmesser 3 ปีที่แล้ว

    Thanks for all

  • @ferretrayn1903
    @ferretrayn1903 3 ปีที่แล้ว +2

    Awesome tutorial. I was able to follow beginning to end as a complete noob. Took a little more time, but i did it haha! I'm stuck on the animations with Mixamo however, I uploaded the unity character model and used it as the skeleton but the animation doesn't seem to actually trigger. I can see in the animator window where it tries to, however!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +2

      The animation doesn't work or its just the animator not changing to that state?
      Make sure the animation is set as humanoid and the animator has the avatar assigned
      And check the conditions for transitioning into and out of that state

    • @Blinkers2007GameDev
      @Blinkers2007GameDev ปีที่แล้ว

      I can't seem to trigger the animation as well even though I did everything codemoney did!

  • @lucasalmeida7951
    @lucasalmeida7951 ปีที่แล้ว

    bru, u sick! seriously! well done!

  • @guidetogamedev3657
    @guidetogamedev3657 3 ปีที่แล้ว

    Thanks! using this controller I could make my LD49 game thanks again

  • @nihalsailor
    @nihalsailor 3 ปีที่แล้ว

    I try to find this tutorial for a long time. Thanks

  • @Zabby
    @Zabby 2 ปีที่แล้ว

    Comment section is very helpful!

  • @aimlezz8855
    @aimlezz8855 ปีที่แล้ว

    What a quality channel! Thanks for video.

  • @lambda-snail
    @lambda-snail ปีที่แล้ว

    Thank you for the great video! I had a problem with the camera jumping around, and it turns out that since I was using the freelook camera, the camera was rotating much slower than (and independently of) the camera target, which caused a desync that looks really weird when going into aiming mode. So there seems to exist a hidden assumption here that you should use the virtual camera unless you want to make some additional changes to the code.
    Just pointing it out if anyone else wants to experiment like me. Thanks for the great video again :)

  • @BenGodot
    @BenGodot 2 ปีที่แล้ว +1

    could you show us how to add animations like crouch, vault and slide? and you should 100% make tutorials on how to make throwables and an inventory system and gun system where we can shoot other people and deal damage and reload and switch guns, etc., it'd be really cool!

  • @marmikparikh967
    @marmikparikh967 3 ปีที่แล้ว +1

    This was a great help!! Had a lot of problems setting up the upper body to move withe crosshair using IK.... Animation Rigging will make it a lot easy.

    • @pytchoun140
      @pytchoun140 3 ปีที่แล้ว

      What you mean by animation rigging ?

    • @marmikparikh967
      @marmikparikh967 3 ปีที่แล้ว

      @@pytchoun140 it's a package provided by unity for runtime dynamic animation

    • @pytchoun140
      @pytchoun140 3 ปีที่แล้ว

      @@marmikparikh967 do you have tutorial?

    • @marmikparikh967
      @marmikparikh967 3 ปีที่แล้ว

      @@pytchoun140 there r tutorials on unity's TH-cam channel. Check it there

    • @pytchoun140
      @pytchoun140 3 ปีที่แล้ว

      @@marmikparikh967 which one

  • @puppycat4142
    @puppycat4142 3 ปีที่แล้ว

    Good to see you 🥰

  • @mtarikan
    @mtarikan ปีที่แล้ว +2

    I just wanna point out this guy still answering questions in more than a 1 year video. True Legend!!!
    in 18:40, I want my character to be constantly fasing the way I'm looking and don't have an aim function. So I just used the code out of if statement and still works great! My only problem is, because player is actually looking to raycasted object, for example if I push my right shoulder to the wall and look at the wall, because of the perspective, object actually moves behind the character and causes to player to actually look back. Is there a possible way that I can fix this?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว

      Heh yup as long as someone posts a comment on the video an not on a reply I'll probably see it the next day.
      For that issue the best solution is to look at how far the target object is, if it's too close then don't look at it. Either lower the rig weight or define a point a certain distance in front

    • @mtarikan
      @mtarikan ปีที่แล้ว

      @@CodeMonkeyUnity Thank you so much for the reply I'll give it a try. Another problem is, I'm running all this on Netcode. Because I don't want other players to shoot for myself, I put my aim point and muzzle point in my player prefab, and then made them separate prefabs so I can reach from transform function. Right now my bullets spawn, but doesn't spawn in my muzzle point, instead spawn at 0,0,0 and doesn't move. What should I do?

  • @Walter_Hartwell_White356
    @Walter_Hartwell_White356 2 ปีที่แล้ว +2

    thank for the video! it was super useful, but where you learned about the animation rigging package? any video?, thank btw

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว

      I read the manual and played around with the samples.
      I've actually got a video on that package coming out this weekend so stay tuned!

  • @TheKr0ckeR
    @TheKr0ckeR 7 หลายเดือนก่อน

    Thanks for great tutorial! How would you handle states with that? Do you think Aiming should have different states? Like, Idle, Moving, Jump, Crouching, Aiming? Do you think its necessary for that? Since aiming if elses getting complex in time, I thought FSM would be cool but i couldnt discriminate them

  • @AppsolusZero
    @AppsolusZero 3 ปีที่แล้ว +2

    Can't wait for the video about Animation Rigging. I'm currently struggling to sync the multi aim constraint with Cinemachine. It causes jittering every times I move the mouse around while aiming.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +2

      Why are you applying the aim constraint to Cinemachine? I didn't touch that at all, the camera works exactly the same, only the arms/weapon are set to aim towards the mouse position.
      If the jittering is from the mouse target position, add some Lerp to smooth it out.

    • @AppsolusZero
      @AppsolusZero 3 ปีที่แล้ว +2

      @@CodeMonkeyUnity Let me explain my setup. Currently, I have a rig layer set up that is solely responsible for aiming the weapon. I have the multi aim constraint set up for the weapon model to aim exactly at an empty transform attached to the camera. The jittering happens to the weapon when I move the mouse around.
      I tried using CinemachineBrain's manual update in Update method, and it fixes the problem. So, my speculation is that by default, the Cinemachine camera's translation and rotation is updated in LateUpdate method, which means the empty transform attached to the camera is also updated in LateUpdate, while the animation rigging is updated in Update method, so the entire rig is out of sync from the camera, causing the jittering.
      That's why I would like to know what kind of setup you made for the polished third person controller. It looks silky smooth.

    • @pytchoun140
      @pytchoun140 3 ปีที่แล้ว

      @@AppsolusZero Want to know too, didnt sucess to do the animation rigging

  • @arionpaul6208
    @arionpaul6208 3 ปีที่แล้ว +1

    Awesome video, thank you)

  • @gmangman123
    @gmangman123 2 ปีที่แล้ว

    Thx so much dude. I need this tutorial my re4 similar game:)

  • @ItsYourBoPhase
    @ItsYourBoPhase ปีที่แล้ว +1

    Hey man great tutorial! On the polishing step what is the difference in you Avatar Masks for the layers and are the two animations for aiming/ stabilizing the same animation? Thanks!

  • @study4686
    @study4686 2 ปีที่แล้ว +1

    very good, thanks for sharing.

  • @rafbanaan
    @rafbanaan 3 ปีที่แล้ว

    Awesome! Always had troubles starting on a system like this. Looking forward to use this in an idea I had that I was always putting on the backlog :p

  • @franksalot114
    @franksalot114 3 ปีที่แล้ว +1

    a tutorial on how to do an rts cover system like company of heroes would be cool.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +1

      I was playing the CoH3 beta a while ago and I thought about that! I might do it when it comes out

  • @ps5games821
    @ps5games821 3 ปีที่แล้ว +1

    Make more tutotials about shooter game please

  • @aeennem3896
    @aeennem3896 2 ปีที่แล้ว +1

    where should I put the bulletProjectileRaycast for the polished game part?

  • @SahilSharma-yq7vr
    @SahilSharma-yq7vr 3 ปีที่แล้ว

    hiiii
    woah , been waiting!!

  • @BBdaCosta
    @BBdaCosta 3 ปีที่แล้ว

    As always awasome explanation, I grab the course of Unity tips thanks again

  • @dftpunk
    @dftpunk 2 ปีที่แล้ว +1

    What is the best way to expand this controller: to add your code inside the existing script or attach another script to an object and add more logic there?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +1

      Depends on what you want to add to it, if its adding some other feature like Auto Aim, I would make it in the same script, if its adding a complex weapon manager logic, I would make a separate script

    • @dftpunk
      @dftpunk 2 ปีที่แล้ว

      @@CodeMonkeyUnity thanks for the prompt reply! I was thinking about adding more actions and animation handlings, like melee fight, taunts/gestures.

  • @CleisonRodriguesComposer
    @CleisonRodriguesComposer 3 ปีที่แล้ว +1

    Great tutorial!
    You're the best!
    Thank you!

  • @tsrajesh
    @tsrajesh 2 ปีที่แล้ว

    Awesome tutorial.
    I have a request.. in continuation to this video, can you please teach on how to ride, say, a horse?. In which case the keys will control the horse, not the player figure sitting on it. Thank you.

  • @GameVersionHack
    @GameVersionHack 2 ปีที่แล้ว

    This is the perfect video that i need
    Thank u very much