Magnitude Hitboxes | How It Works | Roblox Studio

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ม.ค. 2025

ความคิดเห็น • 92

  • @hoonchoi95
    @hoonchoi95 2 หลายเดือนก่อน +62

    I know you did NOT just stop the video right before it hit the bottom right corner!! We want justice!

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +9

      LOL

  • @egggrenade2746
    @egggrenade2746 2 หลายเดือนก่อน +10

    All the classes I failed at my engineering study are coming back to haunt me in studio

  • @Proxiw
    @Proxiw หลายเดือนก่อน +3

    the dvd logo background is quite mesmerizing
    its like putting family guy clips on a short except its an educational video

  • @Teacup44
    @Teacup44 2 หลายเดือนก่อน +6

    you didn't even need the flashy subtitles and image fr the dvd logo alone is enough to take hold of my low attention span

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      Lol, I'll take note for next time.

  • @KCody29
    @KCody29 2 หลายเดือนก่อน +6

    Honestly I'm grateful for your vids that explain what your doing, allows me to not only undestand but to learn new scripts and codes, pls make more when you have the time

    • @KCody29
      @KCody29 2 หลายเดือนก่อน

      Just to ask, is this script an the one you made before for Hit box similar. I have a hard time coding and learning codes, Visual displays help me understand i bit better what the out come should look like and since your last one had that i wanted to know if they were similar in anyway?

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +2

      I'm glad you are enjoying the content! I try to make it easy to understand. More content is coming soon!

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      Same idea and methods behind them, my hitbox module one is more sophisticated for sure.

  • @truarrogancex
    @truarrogancex 2 หลายเดือนก่อน +3

    Finally I see someone covering this!! I see so many people using scuffed hitboxes this is great.

  • @this_elonmust
    @this_elonmust หลายเดือนก่อน

    I knew about magnitude but never thought of using it for attack/hitbox, definitely great vid and widen my knowledge more, could be used for some special attack

  • @JJustMax
    @JJustMax 2 หลายเดือนก่อน +2

    Magnitude Hitboxes? What are you talking about, i came here for the dvd thingy

  • @st3mm
    @st3mm 2 หลายเดือนก่อน +2

    TLDR: Hitbox only detects center of part
    This sounds like a great idea but upon testing, it seems that the hitbox will only detect the enemy (part) if the center of the enemy (part) is touching the hitbox. Though I doubt it'll be any big deal because Roblox characters are already big enough

    • @HellsWaffle
      @HellsWaffle 2 หลายเดือนก่อน

      This seems to work best when detecting player hitboxes vs. AoE attacks to be more forgiving, rather than for projectile collisions and checking enemy positions
      I agree shape casting / spatial query hitboxes would be better anywhere else for hit detection

  • @kowyno
    @kowyno 2 หลายเดือนก่อน +1

    I consider this method of hit registering a very niche one. This would work in any "battleground fighting" game such as "strongest battlegrounds" or games from the same genre. The problem comes with trying to use this same method for other games, such as FPS ones. This method standalone will register a hit even if the victim player is directly below the height of the player, as long as the distance is within the accepted range. Another problem with this system are walls; this method would also register a check even if the victim is at the other side of the wall. As those problems are present, trying to make checks for them would make the code as lengthy as other methods of hit checking, so there wouldn't be any advantage
    So, for the tldr: This method is good for battleground fighting games, but for a different genre, there would be better options definitively
    I appreciate your effort for offering the roblox dev community a source of learning, not everyone does what you're doing
    Keep the good work! :]

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      Yea, when it comes to hitboxes, there isn't a "one solution fits all" for FPS games, def ray casting, for more highly accurate needs, spatial query, and for a standard, general purpose solution, magnitude.

  • @wasdx3545
    @wasdx3545 2 หลายเดือนก่อน

    thank you a lot for this. if I didnt watch this video I wouldn't have realized there was another way to do hitboxes, this is super useful. Thanks

  • @muxa_tuxa9841
    @muxa_tuxa9841 6 วันที่ผ่านมา

    This is awesome!

  • @xvxTheCodingPro
    @xvxTheCodingPro 2 หลายเดือนก่อน

    bro, you don't know how much I needed this. Thx so much

  • @RaccoonWithInternetConnection
    @RaccoonWithInternetConnection 2 หลายเดือนก่อน +1

    I think your videos are really well put together, wishing you luck

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      Thank you!

  • @MrFiveHimself
    @MrFiveHimself หลายเดือนก่อน +1

    just letting you know, this video gave me a great idea and now ive learned lua’s programming. this hell is your fault

    • @Tekleed
      @Tekleed  หลายเดือนก่อน +1

      You are so very welcome.

  • @Weoleo27
    @Weoleo27 2 หลายเดือนก่อน +3

    amazing bro learned more in 3 mins than 1 week at school ☠

  • @Whhatt
    @Whhatt 2 หลายเดือนก่อน +1

    Life saver keep going man!

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      Appreciate it!

    • @Whhatt
      @Whhatt 2 หลายเดือนก่อน

      @@Tekleed just a question I can't find the hitbox module from your previous video inside the discord?

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      yea the video I made about my hitbox module, I made the module paid access, and I regret doing that, but I still have it if you absolutely need it. I would suggest making one yourself though since you will understand it a lot better.

    • @Whhatt
      @Whhatt 2 หลายเดือนก่อน

      @@Tekleed all good

  • @fitmotheyap
    @fitmotheyap 2 หลายเดือนก่อน

    Lovely, more hitbox videos, legends say after watching 50 of them I can make perfect hitboxes and people would still complain

  • @Dumb_Daft_Dim_Lafoole
    @Dumb_Daft_Dim_Lafoole 2 หลายเดือนก่อน +1

    using a screensaver as a background is fucking genious

  • @The_Randomized
    @The_Randomized 2 หลายเดือนก่อน

    I first saw a video, this video and i realized how useful your videos are so i subscribed...

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      Awesome, thank you!

    • @The_Randomized
      @The_Randomized 2 หลายเดือนก่อน

      @@Tekleed you're welcome, I hope I catch up to you

  • @Reev2636
    @Reev2636 2 หลายเดือนก่อน

    This sounds hard. I always just made a part that does damage and made some scripts that it spawns infront of the player who clicked

  • @TheTrashOfDivinity
    @TheTrashOfDivinity 2 หลายเดือนก่อน

    Very epic now my stick doesn't hit people 3 light years away

  • @EngiesParadise
    @EngiesParadise 2 หลายเดือนก่อน

    just call it a spherical hitbox

  • @abdullahtayyab8828
    @abdullahtayyab8828 2 หลายเดือนก่อน +1

    ngl this is very good

  • @R_SilverKnight
    @R_SilverKnight 2 หลายเดือนก่อน

    finally good video explaining physics. 🤓

  • @cheezey3295
    @cheezey3295 2 หลายเดือนก่อน

    I've always preferred raycast hitboxes

  • @Gmantheiv
    @Gmantheiv 2 หลายเดือนก่อน

    A major problem with this method is that its only applicable if you already defined who/what the enemy is.
    This just doesnt seem good for most games.

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      You're right, this method works best with defined enemies, but there are other ways to detect collisions in Roblox Studio, like using Region3s or Raycasting.

  • @luckyboy5nu
    @luckyboy5nu 2 หลายเดือนก่อน

    Could also just use a part infront of the player that checks for trigger collisions which is literally designed for this exact problem

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      this is true, but instancing a part requires replication (adds delay) and using a .touched on a part only checks when something interacts with the part after it is spawned, meaning if you spawn a part inside of a player the .touched won't trigger (or at least in my testing it didn't), there is an alternative hitbox method using GetPartBoundsInBox() which I will go over in another video.

    • @luckyboy5nu
      @luckyboy5nu 2 หลายเดือนก่อน

      @@Tekleed No need to instance the part everytime you do an action, you can just have it be there from the start and only look for .touched during the action, either way these are just a bunch of ways to solve the same problem, obviously you should pick the best one for your case scenario.

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      @luckyboy5nu This is a decent method, but even still, having the part exist is just not needed. If you absolutely need it to be a box like that. The getpartboundsinbox method is still my preferred way to go. ( I used to do the part method ngl 😅 )

    • @luckyboy5nu
      @luckyboy5nu 2 หลายเดือนก่อน

      @@Tekleed The problem with the method you suggested in the video is that:
      1. You are suggesting that in the script we should search/find the player (which you haven't explained how that would be possible, with this method you'd have to check every frame for a nearby player somehow)
      2. Then after that we should take the vector Position of both players (this takes up frame time)
      3. Calculate the difference between the positions of both you and the player
      4. Validate if it is within range and register the hit
      While this is a totally valid method, there's just no real reason to do all this for a simple hit check when Roblox already has meticulously optimized methods of this for you to use, that are much more optimized than the method your showing.

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      1. For finding out positions of players nearby, you can either use octrees, or you can just go through all players in the game, then if they are within a threshold of let's say 100 studs, you can add them to a list to then do the SLIGHTLY more computationally heavy hitbox check.
      2 + 3. Doing a magnitude check is one of the cheapest operations you can do. so even doing it multiple times a frame, on multiple players it will hardly use up any resources.
      On top of all of this relying on Roblox's .Touched function especially for a part, means you would have to rely on the Roblox physics engine to be accurate when doing said hitbox check.
      I do believe the method I explained in this video is the most efficient way of doing hit detection. but unless their are some sort of performance metrics that can prove me wrong. then I will keep using this ngl.

  • @Dadawen69
    @Dadawen69 2 หลายเดือนก่อน

    underrated asf

  • @jlboss_ps4751
    @jlboss_ps4751 หลายเดือนก่อน

    3:36 are you saying that if a character is within the radius of the magnitude we just need to check the direction because how are getting the enemies position from the parameter?

    • @Tekleed
      @Tekleed  หลายเดือนก่อน +1

      so they way you would get the enemies position to check against, would be to loop through all the enemies in the game,
      you can further optimize this by using like octrees or just having a generalized magnitude check first without direction, so instead of checking the whole game, you would just check all enemies with like 100 studs or so.

    • @jlboss_ps4751
      @jlboss_ps4751 หลายเดือนก่อน

      @@Tekleed Oh I see now thank you for the insight, would you also say magnitude checks would be the best choice for games like battlegrounds hitboxes?

    • @Tekleed
      @Tekleed  หลายเดือนก่อน

      @@jlboss_ps4751 there isn't really a universal solution for hitboxes, especially for a game like that since it depends on what move you want to use, like an AOE move would work very well with magnitude, but there is probably a better method if you want heavy constraints on the hitbox.

  • @thingthingthingthingthingthing
    @thingthingthingthingthingthing 2 หลายเดือนก่อน +1

    ADHD VER: magnitude is distance which is sqrt((x1-x2)^2+(y1-y2)^2) thing. If the magnitude is higher than the range of the attack it’s a hit.

  • @archy1702
    @archy1702 2 หลายเดือนก่อน +1

    What about raycast hitboxes? I feel like they are also good

    • @DeltaModelX
      @DeltaModelX 2 หลายเดือนก่อน +1

      idk why the creator didnt reply to this comment because i have the same question

    • @archy1702
      @archy1702 2 หลายเดือนก่อน

      @DeltaModelX yeah i also don't know why lol

  • @JustSeimi
    @JustSeimi 2 หลายเดือนก่อน +2

    Do you edit your own videos

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      Yes

  • @artex_112
    @artex_112 2 หลายเดือนก่อน

    Woudlnt this require the game to iterate over all the enemy players on the game tho? You need to do the check for every possible enemy, In a game that has alot of NPCS or player or even like things you can attack it would mean alot of things to iterate iver and and so in best case time complexity of O(n) and in worst O(n²). I assume this could be prevented with some kind of simplified Spatial check before the magnitude check?

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      Yea, you could optimize it by doing a broad phase check first by just doing the basic magnitude check of like 100 studs, and since that would be super quick, you can then go onto the narrow phase and do the more complicated magnitude + dot product check.

    • @artex_112
      @artex_112 2 หลายเดือนก่อน +1

      @Tekleed This method is still great if mixed with other more accurate but power hungry methods like Raycasts. Thank you for showcasing magnitude checks (i would have never thought of using dot product to limit the angle haha!) I will definitely use this as a spatial precheck thing.

  • @AethernityArts
    @AethernityArts หลายเดือนก่อน

    I'd like to ask, within the parameters of the call function, what does Alive mean? Because I've plugged this in to a script and I ended up with "Alive isn't a valid member of Workspace "Workspace" ".

    • @Tekleed
      @Tekleed  หลายเดือนก่อน +1

      Alive is a folder inside if the workspace will just contain the players / enemies that are alive

    • @AethernityArts
      @AethernityArts หลายเดือนก่อน

      @Tekleed Thank you for the response, much appreciated. I really enjoy the content you produce, very informative and it really does help; which is funny because it made me look back to some lessons I actually learned during math class and it kinda gave me a chuckle watching your videos. You have my sub

    • @Tekleed
      @Tekleed  หลายเดือนก่อน

      @@AethernityArts Lol glad I could help in some way, and thank you gang.

  • @iswearimnottax
    @iswearimnottax 14 วันที่ผ่านมา

    what did i just watch

  • @OmegaDesu
    @OmegaDesu 2 หลายเดือนก่อน

    If I may ask, what advantages would this kind of hitbox method give over the usual, such as Region3, Raycast, and Touched?

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      Performance reasons for sure, it's way quicker for a computer to do the Pythagorean theorem, (which is how the .magnitude property is solved) than to query a region of space using region 3 or anything else.

    • @OmegaDesu
      @OmegaDesu 2 หลายเดือนก่อน +1

      @@Tekleed I see. Thanks for the insight!

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      @@OmegaDesu no problemo

  • @johnnygpoproplayer
    @johnnygpoproplayer หลายเดือนก่อน

    Why not use a hitbox? Is there any major benefit? To me, using a hitbox is far simpler

    • @Tekleed
      @Tekleed  หลายเดือนก่อน

      Performance reasons.

  • @GamesV3-r5s
    @GamesV3-r5s 2 หลายเดือนก่อน

    hi can u make Tool Destruction Or Like Skill Destruction

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      What do you mean by this exactly?

  • @lua_programmer
    @lua_programmer 2 หลายเดือนก่อน

    Is this really performant? I think raycasts would do way better for PvE
    This might be more of a Tower Defense thing.

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      This all depends on what you want to do. There isn't a "one solution fits all kind of thing".

  • @Xtency_X
    @Xtency_X 2 หลายเดือนก่อน

    theekleed moment hier

  • @barnacolium6947
    @barnacolium6947 2 หลายเดือนก่อน

    is there a reason to do this over a spacial query

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน

      It takes fewer resources to do as compared to a query.

  • @letheryxd4846
    @letheryxd4846 2 หลายเดือนก่อน

    I still dont understand how this works :(

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      I can try helping more by giving you an example place to look at, if it will help.

    • @letheryxd4846
      @letheryxd4846 2 หลายเดือนก่อน

      @@Tekleed that would be fantastic actually

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      @@letheryxd4846 Add me on discord and I'll whip up something really quickly

    • @Tekleed
      @Tekleed  2 หลายเดือนก่อน +1

      I actually made it a downloadable place, here is the link to it
      www.roblox.com/games/84285695203255/Magnitude-Hitbox-Demo

    • @letheryxd4846
      @letheryxd4846 2 หลายเดือนก่อน

      @@Tekleed sorry I didnt see this, thanks! Lets see if im up to the math stuff in this

  • @dominiccaesarok5077
    @dominiccaesarok5077 2 หลายเดือนก่อน +1

    Praise Jesus!