Issue when making a plane with new EditableMesh

Ok so all I am trying to do is a make a plane with the new editable meshes however when I add in the triangles it turns into this:

The red parts display where the triangles should fill as they are the vertices. This is my code and I see nothing wrong with it:

local Mesh = Instance.new("EditableMesh")
Mesh.Parent = game.Workspace.MeshPart

local MeshPos = game.Workspace.MeshPart.Position

local vertices = {}
local tris = {}

local PlaneVerts = {}

local Size = 10

for i,v in pairs(Mesh:GetVertices()) do
	Mesh:RemoveVertex(v)
end

PlaneVerts[1] = Mesh:AddVertex(Vector3.new(-Size,0,Size))
PlaneVerts[2] = Mesh:AddVertex(Vector3.new(Size,0,Size))

PlaneVerts[3] = Mesh:AddVertex(Vector3.new(Size,0,-Size))
PlaneVerts[4] = Mesh:AddVertex(Vector3.new(-Size,0,-Size))



for i,v in pairs(PlaneVerts) do
	local show = Instance.new("Part",game.Workspace)
	show.Anchored = true
	print(Mesh:GetPosition(v))
	show.Position = Mesh:GetPosition(v) + MeshPos
	show.Size = Vector3.new(1,1,1)
	show.Name = i
end

local tri1 = Mesh:AddTriangle(PlaneVerts[2],PlaneVerts[3],PlaneVerts[4])
local tri2 = Mesh:AddTriangle(PlaneVerts[2],PlaneVerts[1],PlaneVerts[4])

but that could just be me. Any help on to why this is happening or how I could fix this would be very appreciated :smile:

I seem to be terrible at maths. Just multiplied the z axis by 2.

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