Get faces from vertexId

I have this “Gerstner Waves” editable mesh
Currently I need to get the face that a vertex is attached to so I can use :SetVertexFaceNormal()

	if not w then
		--WaveA
		for _, vert in mesh:GetVertices() do
			local tan = Vector3.new(1,0,0)
			local bi = Vector3.new(0,0,1)
			local tan,bi,p = waveFunc(configsA,mesh:GetPosition(vert),tan,bi)
			local normal = tan:Cross(bi).Unit
			mesh:SetPosition(vert,p)
			normal = mesh:AddNormal(normal)
			mesh:SetVertexFaceNormal(vert,mesh:GetFacesWithAttribute(vert),normal)
		end
	end
end)

I’m using :GetFacesWithAtribute() but that’s deprecated so I can’t use it

1 Like

You need to find the faces a vertex has manually. Loop through all faces, check which ones have the vertex, and then use those for SetVertexFaceNormal.

1 Like

Figured out you can do :GetVertexFaces() and just loop through that