From 445dc667b3159d3d348d50ac960a8597ef061faa Mon Sep 17 00:00:00 2001 From: Cameron White Date: Mon, 6 Apr 2015 16:56:13 -0400 Subject: [PATCH 1/2] Avoid a potential division by zero. --- .../ConstraintSolver/btConeTwistConstraint.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp b/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp index 6a0338631..4a058c3d3 100644 --- a/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp +++ b/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp @@ -778,8 +778,10 @@ void btConeTwistConstraint::calcAngleInfo2(const btTransform& transA, const btTr target[2] = x * ivA[2] + y * jvA[2] + z * kvA[2]; target.normalize(); m_swingAxis = -ivB.cross(target); - m_swingCorrection = m_swingAxis.length(); - m_swingAxis.normalize(); + m_swingCorrection = m_swingAxis.length(); + + if (!btFuzzyZero(m_swingCorrection)) + m_swingAxis.normalize(); } } From a57e1632a6d4f611bcd942647140297207c41f71 Mon Sep 17 00:00:00 2001 From: Kenneth Bogert Date: Tue, 21 Apr 2015 00:31:41 -0400 Subject: [PATCH 2/2] Prevent SSE Alignment crash in VS2010 and up See http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=8915 --- src/LinearMath/btQuadWord.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LinearMath/btQuadWord.h b/src/LinearMath/btQuadWord.h index 11067ef47..fcfb3be44 100644 --- a/src/LinearMath/btQuadWord.h +++ b/src/LinearMath/btQuadWord.h @@ -73,7 +73,7 @@ public: public: -#if defined(BT_USE_SSE) || defined(BT_USE_NEON) +#if (defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE)) || defined(BT_USE_NEON) // Set Vector SIMD_FORCE_INLINE btQuadWord(const btSimdFloat4 vec)