March 31, 2021, 7:50pm
I’m trying to connect all points with their next point in table but it gives me wrong magnitude and even if i created my own function for magnitude but it’s still returns me same numbers and it don’t makes any sense
Also CFrames are not working like they supposed to as you can see on the picture
equations worked before (weeks ago)
and everything is in it’s own order like it supposed to
Are you sure that your function for calculating the magnitude is correct.
local dist = magnitude(point,nextPoint)
Just incase the correct implementation for getting the distance between two points should be
local dist = (point - nextPoint).Magnitude
That is not right at all.
First off is there any reason why you flip the sign while negative.
Second off, you cant slip up the equation into multiple sqrt roots, that breaks algebra.
The correct way is explained above using the Roblox method for it, or if you want to make your own function then you can just do…
local o = a.x - b.x
local o2 = a.y - b.y
local o3 = a.z - b.z
March 31, 2021, 8:04pm
the problem with that is i used roblox magnitude also and it was giving me same results
Its quite difficult to see since you draw so many iterations. But that looks correct to me…
That looks like it
is connecting points correctly, just the wrong points. Which makes sense, since you’re using the index of a table
points as your angle.
Also please post code
so it shows up
instead of posting screenshots.
March 31, 2021, 8:07pm
no it’s not what i want to achieve
a is wrong.
a = 1, a = 2, ... , a = #points because of your loop. I’m assuming you think this means “1 degree”, “2 degrees”, etc.
sin takes an angle in radians, not degrees. That means after
a=4 you’re already wrapped around a full rotation.
math.cos(a) you should do something like
local angle = 2 * math.pi * a / #points -- smoothly spread points around the circle
local x = r * math.cos(angle)
local z = r * math.sin(angle)
(BTW if this fixes your problem you should mark
@Xx1Luffy1xX as the answer, since he actually answered the question you asked)
March 31, 2021, 8:16pm
little correct bc “points” is variable not table