diff --git a/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h b/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h index 1cea7045f..17deef89d 100644 --- a/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h +++ b/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h @@ -123,11 +123,11 @@ SIMD_FORCE_INLINE int btTriangleInfoMap::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btSerializer* serializer) const { btTriangleInfoMapData* tmapData = (btTriangleInfoMapData*) dataBuffer; - tmapData->m_convexEpsilon = m_convexEpsilon; - tmapData->m_planarEpsilon = m_planarEpsilon; - tmapData->m_equalVertexThreshold = m_equalVertexThreshold; - tmapData->m_edgeDistanceThreshold = m_edgeDistanceThreshold; - tmapData->m_zeroAreaThreshold = m_zeroAreaThreshold; + tmapData->m_convexEpsilon = (float)m_convexEpsilon; + tmapData->m_planarEpsilon = (float)m_planarEpsilon; + tmapData->m_equalVertexThreshold =(float) m_equalVertexThreshold; + tmapData->m_edgeDistanceThreshold = (float)m_edgeDistanceThreshold; + tmapData->m_zeroAreaThreshold = (float)m_zeroAreaThreshold; tmapData->m_hashTableSize = m_hashTable.size(); @@ -172,9 +172,9 @@ SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btS btTriangleInfoData* memPtr = (btTriangleInfoData*)chunk->m_oldPtr; for (int i=0;im_edgeV0V1Angle = m_valueArray[i].m_edgeV0V1Angle; - memPtr->m_edgeV1V2Angle = m_valueArray[i].m_edgeV1V2Angle; - memPtr->m_edgeV2V0Angle = m_valueArray[i].m_edgeV2V0Angle; + memPtr->m_edgeV0V1Angle = (float)m_valueArray[i].m_edgeV0V1Angle; + memPtr->m_edgeV1V2Angle = (float)m_valueArray[i].m_edgeV1V2Angle; + memPtr->m_edgeV2V0Angle = (float)m_valueArray[i].m_edgeV2V0Angle; memPtr->m_flags = m_valueArray[i].m_flags; } serializer->finalizeChunk(chunk,"btTriangleInfoData",BT_ARRAY_CODE,(void*) &m_valueArray[0]); diff --git a/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/src/BulletDynamics/Character/btKinematicCharacterController.cpp index f733dc0cd..3b9a7f14c 100644 --- a/src/BulletDynamics/Character/btKinematicCharacterController.cpp +++ b/src/BulletDynamics/Character/btKinematicCharacterController.cpp @@ -160,7 +160,21 @@ btPairCachingGhostObject* btKinematicCharacterController::getGhostObject() bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld* collisionWorld) { + // Here we must refresh the overlapping paircache as the penetrating movement itself or the + // previous recovery iteration might have used setWorldTransform and pushed us into an object + // that is not in the previous cache contents from the last timestep, as will happen if we + // are pushed into a new AABB overlap. Unhandled this means the next convex sweep gets stuck. + // + // Do this by calling the broadphase's setAabb with the moved AABB, this will update the broadphase + // paircache and the ghostobject's internal paircache at the same time. /BW + btVector3 minAabb, maxAabb; + m_convexShape->getAabb(m_ghostObject->getWorldTransform(), minAabb,maxAabb); + collisionWorld->getBroadphase()->setAabb(m_ghostObject->getBroadphaseHandle(), + minAabb, + maxAabb, + collisionWorld->getDispatcher()); + bool penetration = false; collisionWorld->getDispatcher()->dispatchAllCollisionPairs(m_ghostObject->getOverlappingPairCache(), collisionWorld->getDispatchInfo(), collisionWorld->getDispatcher()); diff --git a/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h b/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h index ffbf8a9c7..6fabb3036 100644 --- a/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h +++ b/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h @@ -90,10 +90,10 @@ SIMD_FORCE_INLINE const char* btGeneric6DofSpringConstraint::serialize(void* dat int i; for (i=0;i<6;i++) { - dof->m_equilibriumPoint[i] = m_equilibriumPoint[i]; - dof->m_springDamping[i] = m_springDamping[i]; + dof->m_equilibriumPoint[i] = (float)m_equilibriumPoint[i]; + dof->m_springDamping[i] = (float)m_springDamping[i]; dof->m_springEnabled[i] = m_springEnabled[i]? 1 : 0; - dof->m_springStiffness[i] = m_springStiffness[i]; + dof->m_springStiffness[i] = (float)m_springStiffness[i]; } return "btGeneric6DofSpringConstraintData"; } diff --git a/src/BulletMultiThreaded/vectormath2bullet.h b/src/BulletMultiThreaded/vectormath2bullet.h index 11ee33ada..4cc72ac58 100644 --- a/src/BulletMultiThreaded/vectormath2bullet.h +++ b/src/BulletMultiThreaded/vectormath2bullet.h @@ -37,7 +37,7 @@ inline Vectormath::Aos::Vector3 getVmVector3(const btVector3& bulletVec) { - return Vectormath::Aos::Vector3(bulletVec.getX(),bulletVec.getY(),bulletVec.getZ()); + return Vectormath::Aos::Vector3((float)bulletVec.getX(),(float)bulletVec.getY(),(float)bulletVec.getZ()); } inline btVector3 getBtVector3(const Vectormath::Aos::Vector3& vmVec) @@ -51,7 +51,7 @@ inline btVector3 getBtVector3(const Vectormath::Aos::Point3& vmVec) inline Vectormath::Aos::Quat getVmQuat(const btQuaternion& bulletQuat) { - Vectormath::Aos::Quat vmQuat(bulletQuat.getX(),bulletQuat.getY(),bulletQuat.getZ(),bulletQuat.getW()); + Vectormath::Aos::Quat vmQuat((float)bulletQuat.getX(),(float)bulletQuat.getY(),(float)bulletQuat.getZ(),(float)bulletQuat.getW()); return vmQuat; }