2D Collision Response | C Game + Engine From Scratch 09

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 20

  • @ryuukkkoko874
    @ryuukkkoko874 Місяць тому +1

    i got stuck for days on it, glad i found your channel, thanks for the help

  • @AlexHicks_Tutorials
    @AlexHicks_Tutorials 2 роки тому +4

    Was doing this part this weekend on my engine, was nice to see we came around very closely to the same solution. I do like the exact step for when the collision time is equal and you solve the higher velocity axis first. 👍

  • @crix_h3eadshotgg992
    @crix_h3eadshotgg992 2 роки тому +13

    Here, have some motivation :D

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

    2:38 C does have a sign function in the form of copysign(1, x) which compiles to just 2 instructions (andps with -0.0, orps with 1.0). In the case of x=0 it behaves differently than the method in the video (it returns 1 instead of 0) but that should be ok for the case in the video

  • @manasjoshi2939
    @manasjoshi2939 Рік тому

    really great video! keep it up🙌

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

    If we're calling sweep_response and static_response `iterations` times per physics_update() and and physics_update() is called once per frame isn't the true tick rate fps * iterations??

  • @ashrasmun1
    @ashrasmun1 2 роки тому +1

    2:58 would it be reasonable to get rid of the if-statement and write
    hit.normal[(px < py)] = (px < py)((dx > 0) - (dx < 0)) + (px >= py)((dy > 0) - (dy < 0))
    to make it branchless?

  • @m.hosseinmahmoodi
    @m.hosseinmahmoodi 2 роки тому +4

    Can you push this part's code to Git? Thanks!

  • @mr.treefrog8641
    @mr.treefrog8641 2 роки тому +1

    Are you sure you need stationary response? I remade this in Rust and I commented out my stationery response and I don’t have any issues with tunneling or glitchyness it’s as smooth as can be. Perhaps i am missing something or I am not hitting some edge case?

    • @DylanFalconer
      @DylanFalconer  2 роки тому +1

      I have found that without the stationary response there is glitching through corners. Perhaps there's some difference in the way our code is running that prevents this? Keen to understand why.

    • @billyburton123
      @billyburton123 6 місяців тому +1

      Can you publish your rust version?

  • @sphinxturner3520
    @sphinxturner3520 2 роки тому

    Which ide are you using?

    • @DylanFalconer
      @DylanFalconer  2 роки тому +3

      Neovim, with a few plugins - most notably Telescope, nvim-cmp, and the clangd language server

    • @sphinxturner3520
      @sphinxturner3520 2 роки тому

      Thank you

  • @nobodyinparticular968
    @nobodyinparticular968 2 роки тому

    beautiful, now consider rotated ellipses 😈

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

    please convert that to javascript