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);
}