Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Math] why does magnitude make this Inf or 0?

Asked by 9 years ago

Why would this be making so much lag while the vector3 is being done?

Is the lag problem due to the vector'ing?

All the parts (15 parts) should line up together. Why wont they?

local Ts = TrailParts
local Mag = ((Ts[i+1].Position-Ts[i].Position).magnitude) -- Error here.

print(Mag) -- >> 0,0,0,0,0,0,0,0,INF,0,0,0,0,0 (Output)

--Ts[i].Size = Vector3.new(1,Mag,1)
Ts[i].CFrame = CFrame.new(Ts[i+1].Position,Ts[i].Position)
*CFrame.new(0,0,-Mag/2)
*CFrame.Angles(math.pi/2,0,0)
0
My guess is that the problem is you're getting the magnitude of a point, giving a magnitude of zero or infinity. Based on what you put, I think you're trying to make the size of the part (Ts[i]) based on two corners given by Ts[i+1].Position and Ts[i].Position, so you might have to do that by calculating each vector component (x, y, and z). GoldenPhysics 474 — 9y

Answer this question