Skip to content

Commit a784967

Browse files
committed
update Rigid example
1 parent 9c80f5a commit a784967

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

Examples/RigidSim01/main.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,36 @@ int main()
1111

1212
// ======================================== Phase 1: Init Simulation World Info ========================================
1313

14-
HINASIM::RigidBody sphere1(PBD_MODEL_DIR + std::string("sphere.obj"), {0, -3, 0}, {70, 40, 20}, {2, 2, 2});
15-
HINASIM::RigidBody sphere2(PBD_MODEL_DIR + std::string("sphere.obj"), {0, 3, 0}, {-70, -40, -20}, {1, 1, 1});
16-
HINASIM::RigidBody box1(PBD_MODEL_DIR + std::string("cube.obj"), {0, -5, 0});
17-
HINASIM::RigidBody box2(PBD_MODEL_DIR + std::string("cube.obj"), {0, 5, 0});
14+
HINASIM::RigidBody sphere1(PBD_MODEL_DIR + std::string("sphere.obj"), {0, -3, 0}, {70, 40, 20}, {5, 5, 5});
15+
HINASIM::RigidBody sphere2(PBD_MODEL_DIR + std::string("sphere.obj"), {1, 4, 0}, {-70, -40, -20}, {1, 1, 1});
16+
HINASIM::RigidBody sphere3(PBD_MODEL_DIR + std::string("sphere.obj"), {-1, 6, 0}, {0, 0, 0}, {1, 1, 1});
17+
HINASIM::RigidBody sphere4(PBD_MODEL_DIR + std::string("sphere.obj"), {0, 8, -1}, {0, 0, 0}, {1, 1, 1});
18+
HINASIM::RigidBody sphere5(PBD_MODEL_DIR + std::string("sphere.obj"), {0, 10, 1}, {0, 0, 0}, {1, 1, 1});
19+
HINASIM::RigidBody sphere6(PBD_MODEL_DIR + std::string("sphere.obj"), {0, 12, 0}, {0, 0, 0}, {1, 1, 1});
1820

1921
pbd_sim
2022
.set_collision_engine(&cd)
2123
.add_object(&sphere1)
22-
.add_object(&sphere2);
24+
.add_object(&sphere2)
25+
.add_object(&sphere3)
26+
.add_object(&sphere4)
27+
.add_object(&sphere5)
28+
.add_object(&sphere6);
2329

2430
sphere1.set_inv_mass(0);
2531

2632
cd.add_collider_sphere(&sphere1);
2733
cd.add_collider_sphere(&sphere2);
34+
cd.add_collider_sphere(&sphere3);
35+
cd.add_collider_sphere(&sphere4);
36+
cd.add_collider_sphere(&sphere5);
37+
cd.add_collider_sphere(&sphere6);
2838

2939
pbd_viewer.record(&sphere2);
40+
pbd_viewer.record(&sphere3);
41+
pbd_viewer.record(&sphere4);
42+
pbd_viewer.record(&sphere5);
43+
pbd_viewer.record(&sphere6);
3044
pbd_viewer.record(&sphere1);
3145

3246
// ======================================== Phase 2: Set Up Simulation Thread ========================================

SimulationFrameWork/src/collisions/colliders.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ HINASIM::Collider &HINASIM::Collider::update_aabb()
1818
{
1919
if (object_->TYPE_ == SimObjectType::RigidBody)
2020
aabb_->calc_aabb(dynamic_cast<RigidBody *>(object_)->V_buffer_);
21-
22-
23-
std::cout << "======" << std::endl;
24-
std::cout << aabb_->aabb_[0] << std::endl;
25-
std::cout << aabb_->aabb_[1] << std::endl;
26-
std::cout << "======" << std::endl;
2721
return *this;
2822
}
2923

0 commit comments

Comments
 (0)