Notifications
Clear all

[Closed] [SDK] Accesing particles properties, slow working

Hi,
I am selecting a Particle Flow object as INode, then use this code below to acces each particle property.
Everything works but the more particles the more time to acces each and performance drops, Is there another (faster) way to acces particles (Particle Flow not standard particles)

    INode *tmp_node;
	pblock2->GetValue(pb_source_pick, t, tmp_node, ivalid);	

	ObjectState tos = tmp_node->EvalWorldState(t, TRUE);		
	IParticleObjectExt* epobj = (IParticleObjectExt*)tos.obj->GetInterface(PARTICLEOBJECTEXT_INTERFACE);

	if (epobj)
	{
		epobj->UpdateParticles(tmp_node, t);
		int part_count = epobj->NumParticles();

		myMesh.FreeAll();
		myMesh.setNumVerts(8 * part_count);
		myMesh.setNumFaces(12 * part_count);

		for (int part_id = 0; part_id < part_count; part_id++)
		{
                    // accesing each particle is very slow 
			part_pos = epobj->GetParticlePositionByIndex(part_id);

			//meshBoxBuild(tmp_mesh_1, part_pos, part_id*8, 1.0, true);
			//mycomb(myMesh, tmp_mesh_1, part_id);
		}
	}