Finding most of this out in studio was both enlightening and abit frustrating.
Either I get a negative ( massive number ) when
Part 1 is only a half a stud away from Part 2,
Or a massive positive number, or just flat out 0,0,0; To prevent me going in circles again,
Why does (part1.position, part2.position).Magnitude return a massive number when what you described should return the distance between those two points?
I realize I technically asked this question and you answered, and I still simply donât get it.
Im gonna try one last thing in workspace, I wonder if my problem isnât this.
Im using an explosion to impact multiple parts ( no joint destruction ), using Explosion.Hit and taking its BlastRadius.
Expos is the position of the explosionâs origin.
Parpos is the position of a part.
now I thought, if I only spawn the explosion on impact of a part ( meaning its distance shouldnt be all that much )
My math is the following:
local result = (Parpos - Expos).Magnitude
if result <= BlastRadius then
âŚ
My logic is, if the resultâs distance is within that of the blast radius, then it should work, but in practice it does not, I either get a massive negative number, positive ( that id need to absorbently divide to get a reasonable number ), or literally 0/nil.
I get different results as I change the order of everything, it doesnât really play out in my head that any of this would be incorrect.
I looked on one forum where they used the DOT of two parts and someone started bringing up Trigonometry to get an offset and although I know trig, I did not want to touch that, especially when the example given on robloxâs Forum on how to use explosions never mentions it.
( by the way I tried to use robloxâs sample, it doesnât work, itâs also lengthy and I knew it could be compacted with magnitude, if I could ever get it to work. )
Itâs a shame I donât understand how to use it, because that leaves only one method of doing this and thatâs manually get distances from an explosion to deal drop-off damage.
100 on the center ( <= 1 )
70 next to ( <= 8 )
20⌠so on and so forth; its bad practice and amateurish because Id have to use an if and elseif statement for each distance when I could use a math operator to do this calculation for me.