How to Normalize a Vector

Поділитися
Вставка
  • Опубліковано 9 чер 2022
  • Learn how to normalize a vector with this guide from wikiHow: www.wikihow.com/Normalize-a-V...
  • Навчання та стиль

КОМЕНТАРІ • 13

  • @devmarboy4045
    @devmarboy4045 7 місяців тому +25

    thanks very clear, needed this for player movement

    • @MrGamer-rv7xm
      @MrGamer-rv7xm 6 місяців тому +1

      Same

    • @styxrakash4639
      @styxrakash4639 4 місяці тому

      If you’re in Unity there is a .normalize for vector3’s

    • @tardisman602
      @tardisman602 2 місяці тому

      Me 2

    • @jackylam7328
      @jackylam7328 2 місяці тому

      void normalizeVec(sf::Vector2f& moveVec)
      {
      if (moveVec.x != 0 && moveVec.y != 0)
      {
      float linelength = sqrt(pow(moveVec.x, 2) + pow(moveVec.y, 2));
      moveVec.x /= linelength;
      moveVec.y /= linelength;
      }
      }
      this works well just keep moveVec between 0.0 - 1.0 and then after this function returns just multiply by moveSpeed or however your velocity system works

    • @the_joshi26
      @the_joshi26 Місяць тому

      Same

  • @ProjectMarzDev
    @ProjectMarzDev 9 днів тому

    needed this to make the enemy follow the player lol thanks!

  • @exoticcoder5365
    @exoticcoder5365 9 місяців тому +2

    Very clear video, thank you !

  • @gregfrllo
    @gregfrllo Рік тому +2

    thanks

  • @samuelmatosminaya7801
    @samuelmatosminaya7801 Місяць тому +4

    Like If you're here for game dev

  • @munizogabriel4825
    @munizogabriel4825 11 місяців тому +1

    que video bom

  • @mariacristinaarezzi
    @mariacristinaarezzi 6 місяців тому

    Hello