Magnitude Hitbox

Take a look at this video: https://i.gyazo.com/87865a5181fa29c52294cc8e559a2d9d.mp4

The red-sphere is a size of Vector3.new(35,35,35), to help visualise the hitbox

My question is, how is .Magnitude detecting the NPC outside of the sphere, when the the ‘range/radius’ for detecting is set to ‘35’?

local Range = 35
local  detected = (v:FindFirstChild("HumanoidRootPart").Position - tbl.Origin.Position).Magnitude < Range

Unless I am misunderstanding how to visualise magnitude hitbox (I believe magnitude is a radius, hence a spherical shape would do in visualising the hitbox)?

Magnitude is a radius. Your sphere has radius of 17.5, half of the total size.

1 Like

So, how would I accurately visualise the hitbox in the size of a sphere?

Because in the script, the detecting-radius-range is set to 35, but judging by the video that’s obviously bigger than Vector3.new(35,35,35)

Set the sphere to Vector3.new(70,70,70). Part size is the total size, in case of the sphere it is equivalent to diagonal.
Diagonal is twice the radius.

Spheres do look smaller than the same size cubes.

1 Like

I see, so magnitude radius is x2 the size of the actual range I set?

So If i set the range to be 35, it is actually 70?
And if I actually want ‘35’ I’d have to set it to 17.5?

The magnitude radius is exactly what you set it to.

You are probably confusing diagonal size with radius. When you setting part size, you are not setting the radius (range), but the diagonal size.

image

But yes, you are correct that you need to set the sphere size to twice the range.

1 Like

I appreciate the help Malcom, very informational.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.