Character Rotation | Simple Character Controller in Unity | Part 3

Поделиться
HTML-код
  • Опубликовано: 17 дек 2024

Комментарии • 41

  • @Tysard
    @Tysard 2 года назад +5

    I'm really happy I stumbled across your channel. I never really used character controllers before and this series is very clear and concise so I appreciate your content and thank you for making it.
    I was going to ask a question but fortunately I figured out my rookie mistake so I'll just share my problem and solution incase someone else has the same issue.
    If you're making something like a twin stick shooter and find that using a joystick, your aim is inaccurate/snaps to 8 directions, the code is not the issue. To make your aim more accurate, just open your Input Action Asset and click whatever binding you have set as your "Look" composite (this would be the "Move" composite if you followed part 1 and haven't added any other bindings). Change the "Mode" from "Digital Normalized" to "Analog" and save the asset.
    It may seem silly but I spent a good hour debugging before I figured out that my issue was the input being normalized and not the code doing something I didn't understand.

  • @straylight08
    @straylight08 Год назад +4

    Enjoying these videos. Really well explained

  • @alma82631
    @alma82631 2 месяца назад +1

    Thank you for these perfekt tutorials.

  • @tigerjustice
    @tigerjustice Год назад +3

    Your lessons help me a lot to learn Unity. Thank you very much )

  • @mysh229
    @mysh229 Год назад +2

    Thanks for the guides :) Just what I've been looking for

    • @chonkgames
      @chonkgames  Год назад

      Glad to hear that! Thank you! 🤗

  • @wermisapalma8884
    @wermisapalma8884 Год назад +1

    Really useful to me.
    I am so impressed.

  • @mohammadmohamoud895
    @mohammadmohamoud895 6 месяцев назад +1

    You're genious⚡

  • @cachau9920
    @cachau9920 Год назад +1

    straight to the point, easy to follow and very helpful. ez sub

    • @chonkgames
      @chonkgames  Год назад

      Thanks, much appreciated! 🤗

  • @FlorentinDUBOIS-n4f
    @FlorentinDUBOIS-n4f 9 месяцев назад

    Thanks for your video, with subtittles, you're the best 👍

  • @amac333
    @amac333 10 месяцев назад

    thanks man this was perfect! math ftw

  • @anthonyroseiro
    @anthonyroseiro 9 месяцев назад

    Thank you 🙂

  • @tahacap8573
    @tahacap8573 Год назад +1

    incredible tutorial!

    • @chonkgames
      @chonkgames  Год назад +1

      Thank you, glad you liked it! 🤗

    • @tahacap8573
      @tahacap8573 Год назад

      @@chonkgames thanks a lot again. you explained it very understandable and clearly.

  • @biocronic2986
    @biocronic2986 7 месяцев назад +1

    very good.

    • @chonkgames
      @chonkgames  7 месяцев назад

      Thanks, glad to hear that! 🤗

  • @HelionGames
    @HelionGames 2 года назад +1

    Thanks 👍

  • @xx11s
    @xx11s 6 месяцев назад +1

    Ty

  • @toadieboi3974
    @toadieboi3974 Год назад

    1:45 I've followed through with typing out the code that you've presented, alongside following the rest of the tutorial up to this point, but when I try to playtest said code, I end up with three complier errors, what causes this?
    In specific, it says I don't/have misplaced a semicolon and a "}" and that I don't have an identified.

    • @toadieboi3974
      @toadieboi3974 Год назад

      wait it's cool i just thought the "float:" part of the code was messing with everything

  • @hi-fi2680
    @hi-fi2680 Год назад +1

    great

  • @VeryTori
    @VeryTori Год назад

    Thanks for doing this series! The character no longer snaps to a direction after letting go of the keys, but it is still snapping to the 8 directions rather than being fluid. Not sure if that is supposed to happen, or if I messed up somewhere.

    • @AaronAsherRandall
      @AaronAsherRandall Год назад

      I have exactly the same problem. Did you find a fix for this?

    • @derpysnakemusic3676
      @derpysnakemusic3676 Год назад

      3:00

    • @Lucasvesterlund
      @Lucasvesterlund 6 месяцев назад

      I suppose you're not still stuck on this issue, but in case anyone else gets this problem (like I did), the fix for me was to set the smooth time in the editor to 0.05 in . Somehow it didn't follow from my script into the editor automatically.

  • @dubosemeline1254
    @dubosemeline1254 Год назад +1

    Hello ! I've used your code, and even copied/pasted yours to make sure I disn't miswrite something, but when I play the scene and move my character around, it always has a "floating moment", like even when I release a key the player still moves for around half a second. Do you know what could cause such a thing ?
    Anyway thank you for your videos, they're helping a lot :D

    • @dubosemeline1254
      @dubosemeline1254 Год назад

      Nevermind I found my answer, the problem was that I accidentally added a rigidbody component to my character !

  • @gravecastleofficial
    @gravecastleofficial 7 месяцев назад

    I don't understand how one is supposed to figure out these problems. Like, how would you know to make an if statement for the _input square magnitude in order to solve the snap forward feature? when hovering over the line, it literally only says "returns the squared length of the vector" lol. as if I can just understand that by itself.

  • @petitcoke
    @petitcoke 8 месяцев назад

    how would that last part work if you're using the new input system?

  • @Delvarn
    @Delvarn Год назад

    I had this working earlier but when I've come back to it, my rotation isn't working at all. Its as if it can only read one direction at a time. Any idea why I can't rotate while moving?

  • @jankystreams3337
    @jankystreams3337 Год назад

    How would I go about applying animations to a character using this code? I am using an actual mesh and animations I made rather than a capsule.

  • @swagtrapswag
    @swagtrapswag 10 месяцев назад

    Hi,
    I doubt you will see this message but I have got all of this code exactly the same as yours yet it says c1519 invalid token '=' in class, record, struct or interface member declaration, i cannot find anything for this one since i have the exact line by line code from you,
    Please help

  • @chanelwilson9372
    @chanelwilson9372 Год назад +1

    I put in var targetAngle:float = Mathf.Atan2(y:_directon.x, x:_direction.z) * Mathf.Rad2Deg;
    transform.rotation = Quaternion.Euler(x:0.0f, y:targetAngle, z:0.0f); and it say identifier expected what does that mean

    • @chonkgames
      @chonkgames  Год назад +1

      I’m guessing the confusion lies in my editor. This is what the code for targetAngle should look like:
      var targetAngle = Mathf.Atan2(_direction.x, _direction.z) * Mathf.Rad2Deg;
      The types are just visual indicators to tell me what value the method expects. :)

  • @mj-nl3fc
    @mj-nl3fc Год назад

    Hi, how to move forward relative to rotation?

  • @Minir1
    @Minir1 Год назад +1

    This is so complicated, I dont understand everything. But i started Game Development 1 week ago, to be fair.

    • @chonkgames
      @chonkgames  Год назад

      Let me know if I can help you in any way, and good luck! You’ll do just fine! 🤗