Adjusted simulation scene generation (boxes and spheres)

master
Martin Felis 2021-07-09 20:26:59 +02:00
parent 4834b483ef
commit 40734883d8
1 changed files with 24 additions and 10 deletions

View File

@ -43,17 +43,31 @@ void simulator_init() {
sWorld.mStaticShapes.push_back(sGroundShape);
double restitution = 0.8;
double restitution = 0.5;
int num_spheres = 7;
for (int i = 0; i < num_spheres; i++) {
SimBody sphere_body = CreateSphereBody(
1.,
1.,
restitution,
Vector3d::Random() * 5.,
Vector3d::Zero());
sWorld.mBodies.push_back(sphere_body);
int num_bodies = 10;
for (int i = 0; i < num_bodies; i++) {
SimBody body;
bool create_sphere = i %2;
if (!create_sphere) {
body = CreateBoxBody(
1.,
Vector3d(2., 1., 1.),
restitution,
Vector3d::Random() * 5.,
Vector3d::Zero());
} else {
body = CreateSphereBody(
1.,
1.,
restitution,
Vector3d::Random() * 5.,
Vector3d::Zero());
}
sWorld.mBodies.push_back(body);
}
for (int i = 0; i < sWorld.mBodies.size(); i++) {