From f99b1422ef837ebd528639ff0c210f1f02283fb2 Mon Sep 17 00:00:00 2001 From: Irlan <-> Date: Mon, 26 Mar 2018 16:05:41 -0300 Subject: [PATCH] update a test --- .../tests/spring_cloth_collision_test.h | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/examples/testbed/tests/spring_cloth_collision_test.h b/examples/testbed/tests/spring_cloth_collision_test.h index 966149a..8b4a9e9 100644 --- a/examples/testbed/tests/spring_cloth_collision_test.h +++ b/examples/testbed/tests/spring_cloth_collision_test.h @@ -35,13 +35,20 @@ public: def.mesh = m_meshes + e_clothMesh; def.density = 0.2f; def.ks = 1000.0f; - def.kd = 10.0f; + def.kd = 0.0f; def.r = 0.2f; def.gravity.Set(0.0f, -10.0f, 0.0f); m_cloth.Initialize(def); - b3Sphere* sphere = m_cloth.CreateSphere(b3Vec3(0.0f, -5.0f, 0.0f), 4.0f); + m_clothCapsule.m_centers[0].Set(0.0f, -2.0f, 2.0f); + m_clothCapsule.m_centers[1].Set(0.0f, -2.0f, -2.0f); + m_clothCapsule.m_radius = 2.0f; + + m_clothCapsule.SetFriction(1.0f); + + + m_cloth.AddShape(&m_clothCapsule); } void Step() @@ -61,6 +68,18 @@ public: } m_cloth.Step(dt); + + b3Shape** shapes = m_cloth.GetShapes(); + for (u32 i = 0; i < m_cloth.GetShapeCount(); ++i) + { + b3Shape* s = shapes[i]; + + b3Transform xf; + xf.SetIdentity(); + + g_debugDraw->DrawShape(s, b3Color_white, xf); + } + m_cloth.Draw(g_debugDraw); b3SpringClothStep step = m_cloth.GetStep(); @@ -76,6 +95,7 @@ public: } b3StackAllocator m_clothAllocator; + b3CapsuleShape m_clothCapsule; b3SpringCloth m_cloth; };