Is there a way to set a specific magnitude?

I want to be able to set a specific magnitude of an object, but is it even possible??
Thanks.

Can you word your question differentely, what do you mean with the magnitude of the object?

1 Like

Normalize the vector then multiply it by the magnitude you want.

a.Unit * b

where a is your vector and b is the magnitude you want.

So, if you have a part “x” and want to reposition part “y” such that it has the same angle relative to part “x” but a distance “b” then you can do this:

local x = workspace:WaitForChild("X")

local y = workspace:WaitForChild("Y")

local b = 10
local d = y.Position - x.Position

y.Position = x.Position + d.Unit * b

here is a desmos page you can play around with

3 Likes

I want to be able to set the magnitude of a part to, lets say, 400.

but what is magnitude, the size or position?

1 Like

Part.Velocity.Magnitude, so basically speed in a way

Part.Velocity = Part.Velocity.Unit * DesiredSpeed

1 Like

Thank you, I’ll give that a shot