Movement is Hard

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • You may not think making a player in a game move is all that difficult, but there's a surprising amount of complexity to make that happen. Here's proof. Enjoy.
    Schedule a commission today and get a free logo or jingle of your choosing: • HEY YOU!
    Join my Discord server: / discord
    Follow my Game Jolt: gamejolt.com/@...
    Itch.io too: goofydudeguya....
    Follow my Twitch channel: / goofydudeguya

КОМЕНТАРІ • 9

  • @bobbywalden9818
    @bobbywalden9818 4 дні тому +1

    Genuinely impressed with how much detail is never really considered in game dev, even for the simple concept of movement. REALLY makes you appreciate the tools that those other programs provide. Great video!

  • @Axisok
    @Axisok День тому

    It's much easier to get direction inputs by using var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back"), which combines all directions and limits the magnitude to 1 all in a single line. To translate it into world coordinates, I think all you have to do is var input_v = input_dir.x * transform.basis.x + input_dir.y * transform.basis.z, different variable because that's a Vector3 and the other was a Vector2.
    I'd also avoid using speed for acceleration and instead have a velocity variable, since speed is a float variable with no sense of direction. To accelerate, we add input_v * acceleration * delta, keeping in mind that acceleration is expressed in m/s². If you don't plan on ever letting the player move faster than move speed, all you need to do is limit the velocity magnitude (with Vector3.limit_length(float)) to move speed after adding acceleration. For friction/deceleration, add an opposing force at the beginning of the frame that tries to bring velocity closer to 0 if the player is in contact with the ground. CharacterBody3D already has a velocity variable, which is what you should use for moving around (along with move_and_slide()).
    Not sure if it's the best way to do it, I only played with Godot very casually so I wouldn't know. Still, movement is easy, at least for simple stuff like that.

  • @RoyaltyInTraining.
    @RoyaltyInTraining. 2 дні тому

    The linear algebra courses in college genuinely helped me get a really good intuition for all this stuff
    Edit: I would encourage you to look into building quaternions from euler angles. Quaternions themselves are actually quite often constructed from them in games, since using their four axes directrly is so utterly unintuitive. As long as you limit yourself to standard FPS camera controls in two axes and never attempt to concatenate euler rotations without converting to quaternions first, you will never run into gimbal lock issues. You need to look out for the order of operations your engine uses, and you might have to choose that on a case by case basis.

    • @necoluga7950
      @necoluga7950 День тому

      Yeh lol i studdy math and once i started programing games and concepts such as vectors are intuitively aplyed in alot of places.

    • @goofydudeguya
      @goofydudeguya  День тому

      Thanks for the input! I understand that it would be very beneficial to eventually utilize quaternions in 3D games. The idea of converting eulers to quats sound like a much better way of using them then trying to understand their application directly. 😅
      P.S. Please bear with me since I don't have any formal education in these higher math concepts. I'm running off of self-taught experience and stuff from high school LOL.

  • @MoJaKF
    @MoJaKF 3 дні тому +2

    why does this video not have more views?!