Calculation of vectors does not work on the X

Hello developers!!! :grinning: :grinning: :grinning:
There is something that I cannot explain myself, to make my own breakable glass system, the glass (which is a Part) calculates the points according to its size and position, this system I already did a while ago, and it suits me perfectly. the places where I already implemented it, but there is something strange, to put it in my current place, the calculations in the X do not work, it is only changed in the Y, which I checked by putting a table with 2 points in the space, which one It is the center above the crystal (I only modified the Y) and the other in the central right part (I only modified the X) and I set a part to be created at these coordinates:

local Points = {
	Point1 = Glass.Position + Vector3.new(0, Glass.Size.Y * .5, 0);
	Point2 = Glass.Position + Vector3.new(Glass.Size.X * .5, 0, 0)
};
		
for _, v in pairs(Points) do
	local P = Instance.new("Part")
	P.Anchored = true
	P.Position = v
	P.Parent = workspace
end

And this is how they look:


Any solution?

hola xd pienso que deberias de escribirlo tu ahi en esa place no copiar y pegar si es como lo has hecho
IM SPANISH

Have you tried using glass.Size.Z instead?

Copy and paste a code made by me

make the code in that script not copy and paste maybe you make something bad like an space

From my experience I sometimes have issues adding vectors

You can just test this alternative method and see if it works:

Point1 = Vector3.new(Glass.Position.X + 0, Glass.Position.Y + (Glass.Size.Y * 0.5), Glass.Position.Z + 0)
Point2 = Vector3.new(Glass.Position.X + (Glass.Size.X * 0.5), Glass.Position.Y + 0, Glass.Position.Z + 0)```

Uploading: Captura de pantalla 2021-05-26 173544.jpg…

That looks right. Try this.

Point1 = (Glass.CFrame * CFrame.new(0,Glass.Size.Y/2,0)).p
Point2 = (Glass.CFrame * CFrame.new(0, 0, Glass.Size.Z/2)).p

1 Like

They don’t appear to me this way.
Anyway, I already found the solution, which is similar to the first one you offered, it is the one that Send_Scripts gave, it is to put both the X and the Z in the calculation Thank you all!!! :grinning: :grinning: :grinning: :grinning:

1 Like