I need to add an object for each polygon of a mesh, but code below give me two polygons for one face. Why?
for pn in range(scene.objects[‘Plane’].meshes[0].numPolygons):
poly = scene.objects[‘Plane’].meshes[0].getPolygon(pn)
print(poly)
I need to add an object for each polygon of a mesh, but code below give me two polygons for one face. Why?
for pn in range(scene.objects[‘Plane’].meshes[0].numPolygons):
poly = scene.objects[‘Plane’].meshes[0].getPolygon(pn)
print(poly)
I don’t know coding, but it could be it is counting the triangles not the quads. Each quad has 2 triangles that it is made of. The reason it is show as a quad is so there can be a easily selectable flow when modeling.
Yes, it is counting two tris. Is there a way to count only quads? Otherwise will add two objects for each polygon.
If you have only quads on the model divide by 2. If you have quads mixed with tris there has to be a separate code for getting each which I don’t know because I don’t code.
Ive tried dividing by 2 but doesnt loop through all polygons/faces of the mesh.
Game engines work only with triangles. Quads and N-gons are a construct purely to make creating artwork easier.
Once the engine has started there is no way to retrieve information about what triangles were ‘joined’ into quads.
What effect are you trying to create? Perhaps there is another way?
UPBGE triangulates the mesh, but on BGE you can have quads in game. KX_Polyproxy has the getNumVertex() method that ‘returns the number of vertex of the polygon’, 3 or 4. It is also on UPBGE, I don’t get a deprecation warning, but it always returns 3.
Using only odd numbers for poly indexes solve the problem…Thank you