Creative Coding Math: Collision Detection

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

КОМЕНТАРІ • 21

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

    So cool ! I can't even wrap my head around how they achieve 3D collision with differente meshes on those modern 3D engines. So cool.

    • @DavidLindes
      @DavidLindes Рік тому +1

      I imagine it's a lot like this, with just a few more and/or changed steps. :)
      Hard to wrap one's head around the whole thing, but... if one breaks it down, it becomes more doable in the individual pieces, and then once one has that, then one zooms out, and... it becomes easier. Not always easy, but easier. :)

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

      As far as i am aware in 3D engines they use bounding capsules or just choice a " best" fitting shape to approximate the complex mesh...Just look at how it's done in games engines such as unreal and unity, there is no such thing as pixel perfect coilsion in 3d games, it would cost way too much resources and memory even on the fastest machines.

  • @programmingwithnick
    @programmingwithnick Рік тому +1

    Free time here. You are doing an amazing job. Keep it up!

  • @sarthakmalhotra7413
    @sarthakmalhotra7413 5 місяців тому +1

    I checked out your channel its super lovely what you are doing really hope the best for you. I am also a proud member of your news letter :>

  • @gurudk3378
    @gurudk3378 7 місяців тому +2

    i have a game where circle collides with blocks (rectangles) and need to change the direction of that ball after colliding. How to code it?

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

    Amazing content! Keep it up! Thank you!

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

    Nice and clean explanation.

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

    Very nice tutorial! Subbed, and this video shared with someone I mentor who's just getting into Processing (and/or p5). :) Looks like you have a bunch more, too... excellent!

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

      Oh, one question, though: In the last section, what if mouseX and/or mouseY are between the two edges we check for? seems to me like we just don't set closeX or closeY in those cases?

    • @pattvira
      @pattvira  Рік тому +1

      @@DavidLindes I initialized closeX and closeY as mouseX and mouseY. So if at the very beginning, mouseX and mouseY are already inside the rectangle, then distance would be 0 and would be less than cr and the collision would be detected. So you still want to set closeX and closeY even in that case so that you can calculate the distance. Hope that answered your question!

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

      @@pattvira Ahh, that totally makes sense! I missed the initialization, and I guess it probably wasn't still on the screen at whatever point I paused and looked. :)

  • @gonzaloayala9334
    @gonzaloayala9334 Рік тому +1

    If i want to detect a collision between an array of circles and rects i need a nested for loop?

    • @pattvira
      @pattvira  Рік тому +3

      I have a tutorial that does just what you asked coming out Friday so be on the lookout for it! It’s a combination of OOP and nested loop.

    • @gonzaloayala9334
      @gonzaloayala9334 Рік тому +1

      @@pattvira Cool, ty

    • @DavidLindes
      @DavidLindes Рік тому +1

      @@pattvira haha, awesome that you already have that in the queue. :)

  • @mn4840
    @mn4840 Рік тому +1

    nice!👍

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

      Thank you so much 😊

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

    Nice