From 36a6a898fcfbe0498048be3d0f05c849a5880c5e Mon Sep 17 00:00:00 2001 From: Irlan <-> Date: Fri, 6 Jul 2018 09:40:25 -0300 Subject: [PATCH] consistency --- include/bounce/controllers/body_dragger.h | 15 +++++++-------- include/bounce/controllers/cloth_dragger.h | 1 + src/bounce/dynamics/world.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/bounce/controllers/body_dragger.h b/include/bounce/controllers/body_dragger.h index 13af726..37b28dd 100644 --- a/include/bounce/controllers/body_dragger.h +++ b/include/bounce/controllers/body_dragger.h @@ -46,7 +46,7 @@ public: bool StartDragging() { - B3_ASSERT(m_mouseJoint == nullptr); + B3_ASSERT(IsDragging() == false); b3RayCastSingleShapeOutput out; if (m_world->RayCastSingleShape(&out, m_ray->A(), m_ray->B()) == false) @@ -78,14 +78,13 @@ public: void Drag() { - B3_ASSERT(m_mouseJoint); + B3_ASSERT(IsDragging() == true); m_mouseJoint->SetTarget(GetPointB()); } void StopDragging() { - B3_ASSERT(m_mouseJoint); - + B3_ASSERT(IsDragging() == true); b3Body* groundBody = m_mouseJoint->GetBodyA(); m_world->DestroyJoint(m_mouseJoint); m_mouseJoint = nullptr; @@ -100,19 +99,19 @@ public: b3Body* GetBody() const { - B3_ASSERT(m_shape); + B3_ASSERT(IsDragging() == true); return m_shape->GetBody(); } b3Vec3 GetPointA() const { - B3_ASSERT(m_shape); + B3_ASSERT(IsDragging() == true); return m_shape->GetBody()->GetWorldPoint(m_p); } b3Vec3 GetPointB() const { - B3_ASSERT(m_mouseJoint); + B3_ASSERT(IsDragging() == true); return (1.0f - m_x) * m_ray->A() + m_x * m_ray->B(); } @@ -121,10 +120,10 @@ private: float32 m_x; b3World* m_world; + b3Shape* m_shape; b3Vec3 m_p; b3MouseJoint* m_mouseJoint; }; - #endif \ No newline at end of file diff --git a/include/bounce/controllers/cloth_dragger.h b/include/bounce/controllers/cloth_dragger.h index 9786c49..99fbf2d 100644 --- a/include/bounce/controllers/cloth_dragger.h +++ b/include/bounce/controllers/cloth_dragger.h @@ -210,6 +210,7 @@ private: float32 m_x; b3World* m_world; + b3Cloth* m_cloth; b3ClothMesh* m_mesh; b3ClothMeshTriangle* m_triangle; diff --git a/src/bounce/dynamics/world.cpp b/src/bounce/dynamics/world.cpp index 8981fdb..04dde31 100644 --- a/src/bounce/dynamics/world.cpp +++ b/src/bounce/dynamics/world.cpp @@ -525,8 +525,8 @@ bool b3World::RayCastSingleCloth(b3RayCastSingleClothOutput* output, const b3Vec b3Vec3 point = (1.0f - fraction) * p1 + fraction * p2; b3Vec3 normal = output0.normal; - output->triangle = triangle; output->cloth = cloth0; + output->triangle = triangle; output->point = point; output->normal = normal; output->fraction = fraction;