Hi,
this is very weird, I can’t find the solution, I am looping thru particles count and if I use
GetParticlePositionByIndex(index)
only once everything is ok, but when I try to use it again with different index I am getting the same particle:
ObjectState tos = tmp_node->EvalWorldState(t, TRUE);
IParticleObjectExt* epobj = NULL;
epobj = (IParticleObjectExt*)tos.obj->GetInterface(PARTICLEOBJECTEXT_INTERFACE);
if (epobj)
{
epobj->UpdateParticles(tmp_node, t);
int part_count = epobj->NumParticles();
for (int part_id = 0; part_id < part_count; part_id++)
{
//Mesh tmp_mesh_1, tmp_mesh_2 = mesh;
//meshBoxBuild(tmp_mesh_1, part_pos, 1.0, true);
//CombineMeshes(mesh, tmp_mesh_2, tmp_mesh_1, NULL, NULL, 0);
for (int part_id_2 = 0; part_id_2 < part_count; part_id_2++)
{
if (part_id_2 == part_id) break;
Point3 *part_pos = epobj->GetParticlePositionByIndex(part_id);
Point3 *part_pos_2 = epobj->GetParticlePositionByIndex(part_id_2);
DebugPrint(L"index: %d pos.x: %f\n", part_id, part_pos->x);
DebugPrint(L"index: %d pos.x: %f\n", part_id_2, part_pos_2->x);
DebugPrint(L"\n");
}
}
and this is the output results for 3 emited particles:
index: 1 pos.x: 120,290894
index: 0 pos.x: 120,290894
index: 2 pos.x: 120,290894
index: 0 pos.x: 120,290894
index: 2 pos.x: 120,758293
index: 1 pos.x: 120,758293
index: 3 pos.x: 120,290894
index: 0 pos.x: 120,290894
index: 3 pos.x: 120,758293
index: 1 pos.x: 120,758293
index: 3 pos.x: 56,977779
index: 2 pos.x: 56,977779