Help needed on some coding

Need some help on some coding … i’m currently doing a dominoes effect program using openGL c++ along with tokamak physics engine … i’m having problem with arranging the domino other than arrange it in a straight line … can anybody help me on making the arrangement of domino more random ?
This is the code that makes the domino arrange in straight line … appreciate it …

for (int i = 0; i < N_RIGIDBODY; i++)
{
boxBody[i] = sim->CreateRigidBody();

neGeometry * geom = boxBody[i]->AddGeometry();

geom->SetBoxSize(DOMINO_DEPTH, DOMINO_HEIGHT, DOMINO_WIDTH);

boxBody[i]->UpdateBoundingInfo();

boxBody[i]->SetMass(2.0f);

boxBody[i]->SetInertiaTensor(neBoxInertiaTensor(DOMINO_DEPTH, DOMINO_HEIGHT, DOMINO_WIDTH, 1.0f));

//position of the dominoes
pos.Set((DOMINO_DEPTH * 5.0f * i) + ((float)(rand()% 6 + 2)/100) ,DOMINO_HEIGHT / 2.0f ,0.0f + ((float)(rand()% 1 + 2)));

boxBody[i]->SetPos(pos);
}

Use GL_DOMINO_MORE_RANDOM_ARRANGEMENT ?
Sorry, could not resist :slight_smile:
But seriously, what is the connection to OpenGL in your problem ?
Just add some small rand() value to each domino position.

i hv tried random values but it jus make translation but didnt rotate where the domino is facing , so they are not connected , wat i tried to do is doing a curve shape for the dominoes … now i only manage to do straight line only …

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.