generated mesh bug?

In the generate mesh example, the generated polygons disappear when moving through the scene at a certain angle. I do not know if it is a bug or an error in the code or in the specification of the elements of the geometry. I have made a test with my own code using two polygons to form a plane and the same occurs.

give your file .blender

Sorry, the forum does not allow me to upload files. Anyway, the blend file that is used in the first example of the images is that of the script_genmesh tutorial. In mine I do not think it contains much, since the geometry is generated dynamically, but I include the code that I used.

package arm;

import iron.Scene;
import iron.data.SceneFormat;
import iron.data.Data;
import iron.data.MeshData;
import iron.data.MaterialData;
import iron.system.Input;

@:keep
class MyTrait extends iron.Trait {

var meshData:MeshData;
var materials:haxe.ds.Vector<MaterialData>;

function toF32(ar:Array<Float>):kha.arrays.Float32Array {
	var vals = new kha.arrays.Float32Array(ar.length);
	for (i in 0...vals.length) vals[i] = ar[i];
	return vals;
}

function toU32(ar:Array<Int>):kha.arrays.Uint32Array {
	var vals = new kha.arrays.Uint32Array(ar.length);
	for (i in 0...vals.length) vals[i] = ar[i];
	return vals;
}

function map(){
	for (i in 0...10){
		for (j in 0...10){
			// Create new object in active scene
			var object = Scene.active.addMeshObject(meshData, materials);
			
			// Just for testing, add rigid body trait
			var aabb = meshData.geom.aabb;
			object.transform.loc.set(-8 + j, -8 + i, 0);
			object.transform.buildMatrix();
			object.transform.dim.set(aabb.x, aabb.y, aabb.z);
			object.addTrait(new armory.trait.physics.RigidBody());
		}
	}
}
	

public function new() {
	super();

	var pos:TVertexArray = {
		attrib: "pos",
		size: 3,
		values: toF32([0.0,0.0,0.0,
					   1.0,0.0,0.0,
					   0.0,1.0,0.0,
					   1.0,1.0,0.0])
	};

	var nor:TVertexArray = {
		attrib: "nor",
		size: 3,
		values: toF32([0.0,0.0,1.0,
					   0.0,0.0,1.0,
					   0.0,0.0,1.0,
					   0.0,0.0,1.0])
	};

	var indices:TIndexArray = {
		material: 0,
		values: toU32([0,1,2,1,3,2])
	};

	var rawmeshData:TMeshData = { 
		name: "BoxMesh",
		vertex_arrays: [pos, nor],
		index_arrays: [indices]
	};

	new MeshData(rawmeshData, function(data:MeshData) {
		// Mesh data parsed
		meshData = data;
		meshData.geom.calculateAABB();
		
		// Fetch material from scene data
		Data.getMaterial("Scene", "Material", function(data:MaterialData) {
			// Material loaded
			materials = haxe.ds.Vector.fromData([data]);
			notifyOnUpdate(update);
		});
	});
	
	map();
}

}

It was a bug with frustum culling, should be now fixed in git armory. :slight_smile:

Ok. Thanks for your quick response.